[Solved] Making RSA keys in Java [closed]

The problem is in the 4th from bottom line of code: System.out.println((noSuchProvdr.getMessage()); ^ Remove the extra parenthesis from there to make it System.out.println(noSuchProvdr.getMessage()); Edit: If the compiler is telling you java.security.NoSuchProviderException is never thrown in body of corresponding try statement, remove this last catch block catch (NoSuchProviderException noSuchProvdr) { System.out.println((noSuchProvdr.getMessage()); } 3 solved Making RSA … Read more

[Solved] convert java code with RSA to c#

X509EncodedKeySpec is the SubjectPublicKey part of a certificate. So you probably need to decode this structure. You could look at BouncyCastle for C# and check out Org.BouncyCastle.Asn1.X509.SubjectPublicKeyInfo.GetInstance(byte[]) 1 solved convert java code with RSA to c#

[Solved] Encrypt string using PCLCrypto

Follow the documentation for AES encryption and modify it for RSA. Use AsymmetricAlgorithm.RsaPkcs1 as algorithm provider. Below example is for AES. byte[] keyMaterial; byte[] data; var provider = WinRTCrypto.SymmetricKeyAlgorithmProvider.OpenAlgorithm(SymmetricAlgorithm.AesCbcPkcs7); var key = provider.CreateSymmetricKey(keyMaterial); // The IV may be null, but supplying a random IV increases security. // The IV is not a secret like the … Read more

[Solved] Java RSA private key generation when public key is known

Sort answer is “no”. Long answer is to use sunrsasign Provider, which implements RSAKeyPairGenerator such that the public exponent is 65537: *”/** * RSA keypair generation. Standard algorithm, minimum key length 512 bit. * We generate two random primes until we find two where phi is relative * prime to the public exponent. Default exponent … Read more

[Solved] Bad Data exception during RSA decryption

Among other problems you are assuming that the ciphertext can be converted to UTF-8 meaningfully, and that isn’t guaranteed. If you want to encrypt text and transmit/store the encrypted contents as text you need to follow this pattern: Encrypt(textIn => textOut): Convert textIn to bytesIn via some encoding. UTF-8 is pretty good. Encrypt bytesIn to … Read more