Add utility to convert JWKs to / from std Java keys in java.security.interfaces
Possible uses:
- Convert between JWK sets and Java keystore keys.
- Pass key args to crypto providers as JWKs.
The std Java key interfaces defined in java.security.interfaces:
ECKey
ECPrivateKey
ECPublicKey
RSAKey
RSAMultiPrimePrivateCrtKey
RSAPrivateCrtKey
RSAPrivateKey
RSAPublicKey
Comments (8)
-
-
reporter Good idea, and will fit solution 1 nicely (else we'll need to use full class names to prevent collision with java.security.interfaces.ECPublicKey and java.security.interfaces.RSAPublicKey).
How about
toECPublicKey() toECPrivateKey() toKeyPair()
resp.
toRSAPublicKey() toRSAPrivateKey() toKeyPair()
?
-
Looks good to me.
-
Proposed solution pushed into branch native-keys.
Handles RSA keys in and out, symmetric keys outbound, and has unimplemented stubs for EC keys. Does not handle RSA CRT-formatted keys yet.
-
reporter - changed status to open
To generate the Java representations of the public + private ECKeys we'll need to lookup or hardwire the P curve constants defined in fips_186-3.pdf, page 89.
-
reporter Added CRT support to RSAKey.toRSAPrivateKey() in commit 9449eaa.
With that the RSAKey class covers all required java.security imports + exports, JUnit tests still need to be written though :)
-
reporter RSA key import / export completely covered now.
-
- changed status to resolved
RSA and octet keys covered, moving EC to a new issue
- Log in to comment
I think these should be handled by the JWK classes themselves. I'll add a branch that implements this.