SO I have this code
private static RSAPrivateKey buildRSAPrivateKey(String privateKey) {
PEMReader pemReader = new PEMReader(new StringReader(privateKey));
try {
KeyPair pair = (KeyPair) pemReader.readObject();
RSAPrivateKey result = (RSAPrivateKey)pair.getPrivate();
pemReader.close();
return result;
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
It works fine using bouncycastle
, however I need this to function on Android, so I imported SpongyCastle
, however spongy castle does not have PEMReader
(apparently PEMReader
is in an older bouncycastle version)
How can I create an RSAPrivateKey
equivalent to the above code without using bouncycastle's PEMReader
?