The KeyFactory Class:
The KeyFactory class is an engine class that is
designed to provide opaque cryptographic keys (of type Key)
and key specifications (transparent representations of the underlying
key material).
- DSA
The keys generated by this provider are similar to the keys that are available in a software provider. However, the keys have more methods that relate to the PKCS#11 standard attributes.
The
KeyFactoryclass can be used to generate a DSA Private PKCS#11 key from aDSAPrivateKeySpecor aPKCS11KeySpec. TheKeyFactorycan also be used to generate a DSA public key from aDSAPublicKeySpec, anX509EncodedKeySpec, or aPKCS11KeySpec.The
KeyFactoryclass can also derive aDSAPrivateKeySpecfrom a DSA Private PKCS#11 key or aDSAPublicKeySpecorX509PublicKeySpecfrom a DSA public key.The KeyPairGenerator class requires the use of the classPKCS11DSAKeyPairParameterSpecif the defaults are not to be used. An application is not allowed to only specify the key size, or the key size and source of randomness. This class is required for all non-default key pair generations.Note: That specifying a source of randomness is not required, because the device uses its own source to generate keys.- RSA
This provider handles RSA keys similar to the DSA keys listed previously.
RSA is similar to DSA in that the
KeyFactoryclass can be used to generate a RSA Private PKCS#11 key from anRSAPrivateCrtKeySpec,RSAPrivateKeySpecor aPKCS11KeySpec. TheKeyFactorycan also be used to generate an RSA public key from anRSAPublicKeySpec, anX509EncodedKeySpec, or anPKCS11KeySpec. The opposite can also be done to generate anRSAPrivateCrtKeySpecor anRSAPrivateKeySpecfrom an RSA private PKCS#11 key and anRSAPublicKeySpecorX509EncodeKeySpeccan be generated from an RSA public key.The KeyPairGenerator class is also similar and if an application needs to create an RSA key pair that does not use the defaults, thePKCS11RSAKeyPairParameterSpecclass must be used. An application is not allowed to only specify the key size, or the key size and source of randomness. This class is required for all non-default key pair generations.Note: That specifying a source of randomness is not required, because the device uses its own source to generate keys.- EC
-
This provider handles EC keys similar to the DSA keys listed previously.
EC is similar to DSA in that the
KeyFactoryclass can be used to generate a EC Private PKCS#11 key from anECPrivateKeySpecor aPKCS11KeySpec. TheKeyFactorycan also be used to generate an EC public key from anECPublicKeySpec, anX509EncodedKeySpec, or anPKCS11KeySpec. The opposite can also be done to generate anECPrivateKeySpecfrom an EC private PKCS#11 key and anECPublicKeySpecorX509EncodeKeySpeccan be generated from an EC public key.The KeyPairGenerator class is also similar, theECParameterSpecclass can be used to generate key pair or an application can only specify the key size, or the key size and source of randomness to generate key pair.Note: That specifying a source of randomness is not required, because the device uses its own source to generate keys.