You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.




org.mozilla.jss.provider.java.security
Class KeyFactorySpi1_2

java.lang.Object
  extended by java.security.KeyFactorySpi
      extended by org.mozilla.jss.provider.java.security.KeyFactorySpi1_2
Direct Known Subclasses:
KeyFactorySpi1_4

public class KeyFactorySpi1_2
extends java.security.KeyFactorySpi


Constructor Summary
KeyFactorySpi1_2()
           
 
Method Summary
protected  java.security.PrivateKey engineGeneratePrivate(java.security.spec.KeySpec keySpec)
          We don't support RSAPrivateKeySpec because it doesn't have enough information.
protected  java.security.PublicKey engineGeneratePublic(java.security.spec.KeySpec keySpec)
           
protected  java.security.spec.KeySpec engineGetKeySpec(java.security.Key key, java.lang.Class keySpec)
           
protected  java.security.Key engineTranslateKey(java.security.Key key)
          Translates key by calling getEncoded() to get its encoded form, then importing the key from its encoding.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyFactorySpi1_2

public KeyFactorySpi1_2()
Method Detail

engineGeneratePublic

protected java.security.PublicKey engineGeneratePublic(java.security.spec.KeySpec keySpec)
                                                throws java.security.spec.InvalidKeySpecException
Specified by:
engineGeneratePublic in class java.security.KeyFactorySpi
Throws:
java.security.spec.InvalidKeySpecException

engineGeneratePrivate

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

Specified by:
engineGeneratePrivate in class java.security.KeyFactorySpi
Throws:
java.security.spec.InvalidKeySpecException

engineGetKeySpec

protected java.security.spec.KeySpec engineGetKeySpec(java.security.Key key,
                                                      java.lang.Class keySpec)
                                               throws java.security.spec.InvalidKeySpecException
Specified by:
engineGetKeySpec in class java.security.KeyFactorySpi
Throws:
java.security.spec.InvalidKeySpecException

engineTranslateKey

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

Specified by:
engineTranslateKey in class java.security.KeyFactorySpi
Throws:
java.security.InvalidKeyException