From: "David Taylor" <dtaylor@forge.com.au>
To: Bernard Leach <leachbj@aba.net.au>
Date: Fri, 21 May 1999 11:19:24 +1000
Subject: Re: Decrypting PKCS8 private keys
>This assumes that the key returned by cert.getPublicKey() returns
>a X.509 encoded key. Now thats not really unreasonable but perhaps
>the X509Certificate documenation should suggest that it should
>return keys like that.
That's not a bad point - java.security.cert.Certificate does not represent
X509 certificates. So you can't assume an X509EncodedKeySpec will come from
the cert.getPublicKey().getEncoded() call.
However, the java.security.cert.X509Certificate documentation could
stipulate the above method invocation returns an X509EncodedKeySpec
containing the SubjectPublicKeyInfo structure.
Then, if you know you're dealing with X509 certs, you're okay. PGP used to
use RSA keys, didn't it? What would you get from a PGP cert
getPublicKey().getEncoded()? I don't really care as I'm not using them, but
it's an interesting question to see what should happen with other certs
that have RSA keys (or whatever).
Regards,
David.