Top Description Fields Constructors Methods
sun.security.pkcs11

pack-priv abstract Class P11KeyFactory

extends KeyFactorySpi
Class Inheritance
Known Direct Subclasses
sun.security.pkcs11.P11RSAKeyFactory, sun.security.pkcs11.P11DHKeyFactory, sun.security.pkcs11.P11DSAKeyFactory, sun.security.pkcs11.P11ECKeyFactory
Imports
java.security.*, java.security.spec.*, java.util.Map, .HashMap, .Locale, sun.security.pkcs11.wrapper.PKCS11Exception

KeyFactory base class. Provides common infrastructure for the RSA, DSA, and DH implementations. The subclasses support conversion between keys and keyspecs using X.509, PKCS#8, and their individual algorithm specific formats, assuming keys are extractable.
Author
Andreas Sterbenz
Since
1.5

Field Summary

Modifier and TypeField and Description
pack-priv final String
private static final Map<String, Long>
pack-priv final Token

Constructor Summary

AccessConstructor and Description
pack-priv
P11KeyFactory(Token token, String algorithm)

Method Summary

Modifier and TypeMethod and Description
private static void
addKeyType(String name, long id)

pack-priv static P11Key
convertKey(Token token, Key key, String algorithm)

Convert an arbitrary key of algorithm into a P11Key of token.

protected final <T extends KeySpec> T
engineGetKeySpec(Key
the key.
key
,
Class<T>
the specification class in which the key material should be returned.
keySpec
)

Implements abstract java.security.KeyFactorySpi.engineGetKeySpec.

Returns a specification (key material) of the given key object.

protected final Key
engineTranslateKey(Key
the key whose provider is unknown or untrusted.
key
)

Implements abstract java.security.KeyFactorySpi.engineTranslateKey.

Translates a key object, whose provider may be unknown or potentially untrusted, into a corresponding key object of this key factory.

pack-priv static long
pack-priv abstract <T extends KeySpec> T
implGetPrivateKeySpec(P11Key key, Class<T> keySpec, Session[] session)

pack-priv abstract <T extends KeySpec> T
implGetPublicKeySpec(P11Key key, Class<T> keySpec, Session[] session)

pack-priv abstract KeyFactory
pack-priv abstract PrivateKey
pack-priv abstract PublicKey
Inherited from java.security.KeyFactorySpi:
engineGeneratePrivateengineGeneratePublic

Field Detail

algorithmback to summary
pack-priv final String algorithm
keyTypesback to summary
private static final Map<String, Long> keyTypes
tokenback to summary
pack-priv final Token token

Constructor Detail

P11KeyFactoryback to summary
pack-priv P11KeyFactory(Token token, String algorithm)

Method Detail

addKeyTypeback to summary
private static void addKeyType(String name, long id)
convertKeyback to summary
pack-priv static P11Key convertKey(Token token, Key key, String algorithm) throws InvalidKeyException

Convert an arbitrary key of algorithm into a P11Key of token. Used by P11Signature.init() and RSACipher.init().

engineGetKeySpecback to summary
protected final <T extends KeySpec> T engineGetKeySpec(Key key, Class<T> keySpec) throws InvalidKeySpecException

Implements abstract java.security.KeyFactorySpi.engineGetKeySpec.

Doc from java.security.KeyFactorySpi.engineGetKeySpec.

Returns a specification (key material) of the given key object. keySpec identifies the specification class in which the key material should be returned. It could, for example, be DSAPublicKeySpec.class, to indicate that the key material should be returned in an instance of the DSAPublicKeySpec class.

Parameters
<T>
the type of the key specification to be returned
key:Key

the key.

keySpec:Class<T>

the specification class in which the key material should be returned.

Returns:T

the underlying key specification (key material) in an instance of the requested specification class.

Exceptions
InvalidKeySpecException:
if the requested key specification is inappropriate for the given key, or the given key cannot be dealt with (e.g., the given key has an unrecognized format).
engineTranslateKeyback to summary
protected final Key engineTranslateKey(Key key) throws InvalidKeyException

Implements abstract java.security.KeyFactorySpi.engineTranslateKey.

Doc from java.security.KeyFactorySpi.engineTranslateKey.

Translates a key object, whose provider may be unknown or potentially untrusted, into a corresponding key object of this key factory.

Parameters
key:Key

the key whose provider is unknown or untrusted.

Returns:Key

the translated key.

Exceptions
InvalidKeyException:
if the given key cannot be processed by this key factory.
getPKCS11KeyTypeback to summary
pack-priv static long getPKCS11KeyType(String algorithm)
implGetPrivateKeySpecback to summary
pack-priv abstract <T extends KeySpec> T implGetPrivateKeySpec(P11Key key, Class<T> keySpec, Session[] session) throws PKCS11Exception, InvalidKeySpecException
implGetPublicKeySpecback to summary
pack-priv abstract <T extends KeySpec> T implGetPublicKeySpec(P11Key key, Class<T> keySpec, Session[] session) throws PKCS11Exception, InvalidKeySpecException
implGetSoftwareFactoryback to summary
pack-priv abstract KeyFactory implGetSoftwareFactory() throws GeneralSecurityException
implTranslatePrivateKeyback to summary
pack-priv abstract PrivateKey implTranslatePrivateKey(PrivateKey key) throws InvalidKeyException
implTranslatePublicKeyback to summary
pack-priv abstract PublicKey implTranslatePublicKey(PublicKey key) throws InvalidKeyException