Posts

Showing posts with the label rsa

Wrong RSA PrivateKey KeyStore

Wrong RSA PrivateKey KeyStore My app generates a KeyPair when it's opened. I can encrypt text with the PublicKey but when I try to decrypt it with the PrivateKey it throws InvalidKeyException . KeyPair PublicKey PrivateKey InvalidKeyException Some Log.v debug: Log.v (...) V/Aliases: The public key created is [android.security.keystore.AndroidKeyStoreRSAPublicKey@1840131a] (...) V/Aliases: The private key created is [android.security.keystore.AndroidKeyStoreRSAPrivateKey@37ad0430] (...) V/Aliases: The public key used is [android.security.keystore.AndroidKeyStoreRSAPublicKey@1840131a] (...) V/Aliases: The private key used is [android.security.keystore.AndroidKeyStoreRSAPrivateKey@37ad0430] (...) V/Aliases: The private key [android.security.keystore.AndroidKeyStoreRSAPrivateKey@37ad0430] is incorrect KeyPair generation: KeyPair try { //Load KeyStore keystore = KeyStore.getInstance("AndroidKeyStore"); keystore.load(null); } catch (KeyStoreException | IOExcep...