Hallo,
ich habe ein ähnlich gelagertes Problem.
Ich möchte einen PublicKey aus einem keyfile instantieren.
FileInputStream fis =new FileInputStream(PUBLIC_KEY_FILE);
byte[] pubKeyBytes = new byte[(int)PUBLIC_KEY_FILE.length()];
fis.read(pubKeyBytes);
fis.close();
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
X509EncodedKeySpec pubSpec = new X509EncodedKeySpec(pubKeyBytes);
RSAPublicKey pubKey = (RSAPublicKey) keyFactory.generatePublic(pubSpec);
leider bekomme ich eine: java.security.InvalidKeyException: invalid key format
Da key file hat folgendes Format:
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: PGP 6.5.2
mQGiBDlN8GERBADiIjPjksdfhklashd76a9wqcmGuuzfwHzNo+nHGNBa/UrI0XS6
somthing cutetd out here
UUXcjNnHFKoQDHyWjk1lhBUfe/iWn0IYiL69TrZoLZPh7alkmYkARgQYEQIABgUC
OU3wYQAKCRA9xJPyWjk1lhBUfeyWjk1lhBUfeyWjk1lhBOeRzJZfeACfc1HwyNx0
896YD5LYEqPB49SLfxc=
=wOMv
-----END PGP PUBLIC KEY BLOCK-----
Welcher Algo steckt eigentlich hinter PGP? ist das RSA