org.mozilla.jss.provider.java.security

Class KeyFactorySpi1_2

Known Direct Subclasses:
KeyFactorySpi1_4

public class KeyFactorySpi1_2
extends java.security.KeyFactorySpi

Method Summary

protected java.security.PrivateKey
engineGeneratePrivate(KeySpec keySpec)
We don't support RSAPrivateKeySpec because it doesn't have enough information.
protected PublicKey
engineGeneratePublic(KeySpec keySpec)
protected KeySpec
engineGetKeySpec(Key key, Class keySpec)
protected Key
engineTranslateKey(Key key)
Translates key by calling getEncoded() to get its encoded form, then importing the key from its encoding.

Method Details

engineGeneratePrivate

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

engineGeneratePublic

protected PublicKey engineGeneratePublic(KeySpec keySpec)
            throws InvalidKeySpecException

engineGetKeySpec

protected KeySpec engineGetKeySpec(Key key,
                                   Class keySpec)
            throws InvalidKeySpecException

engineTranslateKey

protected Key engineTranslateKey(Key key)
            throws InvalidKeyException
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.