org.mozilla.jss.provider.java.security

Class KeyFactorySpi1_2

public class KeyFactorySpi1_2 extends KeyFactorySpi

Method Summary
protected PrivateKeyengineGeneratePrivate(KeySpec keySpec)
We don't support RSAPrivateKeySpec because it doesn't have enough information.
protected PublicKeyengineGeneratePublic(KeySpec keySpec)
protected KeySpecengineGetKeySpec(Key key, Class keySpec)
protected KeyengineTranslateKey(Key key)
Translates key by calling getEncoded() to get its encoded form, then importing the key from its encoding.

Method Detail

engineGeneratePrivate

protected PrivateKey engineGeneratePrivate(KeySpec keySpec)
We don't support RSAPrivateKeySpec because it doesn't have enough information. You need to provide an RSAPrivateCrtKeySpec.

engineGeneratePublic

protected PublicKey engineGeneratePublic(KeySpec keySpec)

engineGetKeySpec

protected KeySpec engineGetKeySpec(Key key, Class keySpec)

engineTranslateKey

protected Key engineTranslateKey(Key key)
Translates key by calling getEncoded() to get its encoded form, then importing the key from its encoding. Two formats are supported: "X.509", which is decoded with an X509EncodedKeySpec; and "PKCS#8", which is decoded with a PKCS8EncodedKeySpec.

This method is not well standardized: the documentation is very vague about how the key is supposed to be translated. It is better to move keys around by wrapping and unwrapping them; or by manually translating to a KeySpec, then manually translating back to a Key.