public-key-encryption

RSA on Android is different from PC

北战南征 提交于 2019-12-10 11:40:39
问题 I search a lot but I didn't find the useful answer. I develop java and android security application. I found some problem that when I create RSA key on PC and I transfer RSA public key to android. When I encrypt my data with public key on android and I decrypt the data by using private key on PC, it shows Badpadding Exception. I search on the google on this exception. I found some user that has the same problem to me but the answer is no use. They told me to use Base64 to encode it but the

Software licencing scheme [closed]

喜夏-厌秋 提交于 2019-12-10 10:56:01
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 years ago . I've devised the following mechanism so as to license a software without direct connection to a server, it seems simple, yet I fail to find any serious flaw: I plan to use asymetric crypto so as to send a message from 1 server (the licence server) to n clients (the n

Can someone tell me what's wrong with my openssl_sign example

白昼怎懂夜的黑 提交于 2019-12-10 10:38:01
问题 Here's php demo code to sign data with private 2048 bit dsa key: $priv_key = '-----BEGIN DSA PRIVATE KEY----- MIIDVQIBAAKCAQEA/uhSKJA6k5sSnYo+uBgi+mzJ72hqZrWgc+dNLpiiKoHsqDZ6 7kGW0J3wnhU0FxpV2SVL57SfG6dC7GvwsJYBidSEJqe3bARP8WI4yL9wm1PVTqFD 4zNkj1+zUZDWQWpJxaA8I10sJR08/WbwgD63bD6jg4JiPaowFMOrufYAW92hjANQ D7eZ+t0GXAoDB5L6q8btVRfJrGOvkdDN6eyzc7kpJEVC9g1J9Q6glnHQRIGdW4Ot ys/bpv2mGMfEykyTWhcMSLaAZ0YLTyKRfjYm8g7dCFWo3i8Fu0Jr+N3IWZI9Jgw5 lGyUSX8x89gjMsqtcOzcrjOtC51oAh

Which public key (SP or remote IDP) to use while signing SAML request

六月ゝ 毕业季﹏ 提交于 2019-12-09 13:15:56
问题 I am trying to configure my application (SP) to work with remote IDP. The IDP provided me with a certificate to configure with SP. For SAML request, do I use SP's public key or IDP's? Also, where can I find good resources to study SAML in detail (apart from the oasis formal documents). The tutorials that I find are very simplistic (i.e. they just describe that SP goes to IDP and then it is redirected back but do not go into detail on SAML messages). The oasis documents are confusing. Thanks

Java - Diffie-Hellman Encryption - Wrong Output

二次信任 提交于 2019-12-09 07:20:48
问题 I'm attempting to implement Diffie-Hellman key exchange. I am a little confused with how to use the secret key once generated. As seen in the output, the 2 secret keys are generated using the same prime & base as normal in the key exchange, and trade public keys when generating the secret keys, however they are not outputting the same value as I expected. I'm getting very confused with how to implement this encryption method and would be very grateful for some direction. My overall aim for

How to use apache vfs2 for sftp with public-private-key and without password

陌路散爱 提交于 2019-12-09 04:51:42
问题 Currently I am using apache vfs2 to download files from a sftp. For authentication I use user-name and password. Is there a way to use vfs2 only with public-private-keys and without a password? I think I have use this function,but how? Set it only to "yes"? SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(options, "no"); This is my current code (snippet): private boolean downloadFile(){ StandardFileSystemManager sysManager = new StandardFileSystemManager(); //download der

How to encrypt a string using public key cryptography

为君一笑 提交于 2019-12-09 03:23:42
问题 I am trying to implement my own RSA encryption engine. Given these RSA algorithm values: p = 61. // A prime number. q = 53. // Also a prime number. n = 3233. // p * q. totient = 3120. // (p - 1) * (q - 1) e = 991. // Co-prime to the totient (co-prime to 3120). d = 1231. // d * e = 1219921, which is equal to the relation where 1 + k * totient = 1219921 when k = 391. I am trying to write a method to encrypt each byte in a string and return back an encrypted string: public string Encrypt(string

Getting error in EVP_OpenInit() of OpenSSL EVP api for RSA decryption, in C

放肆的年华 提交于 2019-12-09 01:17:10
问题 I am facing a problem in RSA decryption using OpenSSL Library (EVP api). Here is my code for key generation #include <stdio.h> #include <openssl/evp.h> #include <openssl/rsa.h> #include <openssl/bio.h> #include <openssl/pem.h> #define SECFILE "sec.pem" #define PUBFILE "pub.pem" int main() { EVP_PKEY_CTX *ctx; EVP_PKEY *pkey = NULL; ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_RSA, NULL); FILE *fp; if (!ctx) { /* Error occurred */ perror("Error in CTX \n"); } if (EVP_PKEY_keygen_init(ctx) <= 0) { /*

GnuPG/PGP and SSL: Sharing the same private key?

。_饼干妹妹 提交于 2019-12-08 19:10:44
问题 I'm trying to sort out my use of digital signatures and encryption. I understand that there are 2 main ways to do this: the PGP way and the SSL way. What I would like to know if it's possible to use the same private key for both SSL certificate and GnuPG, providing that this is a RSA 2048 bit key. I already have an SSL certificate signed by a CA, so I was hoping to use that certificate's private key as the GnuPG master private key. I know that we can't make assertions between the SSL and

Calculating Eulers Totient Function for very large numbers JAVA

早过忘川 提交于 2019-12-08 18:28:31
I've managed to get a version of Eulers Totient Function working, albeit one that works for smaller numbers (smaller here being smaller compared to the 1024 bit numbers I need it to calculate) My version is here - public static BigInteger eulerTotientBigInt(BigInteger calculate) { BigInteger count = new BigInteger("0"); for(BigInteger i = new BigInteger("1"); i.compareTo(calculate) < 0; i = i.add(BigInteger.ONE)) { BigInteger check = GCD(calculate,i); if(check.compareTo(BigInteger.ONE)==0) {//coprime count = count.add(BigInteger.ONE); } } return count; } While this works for smaller numbers,