public class EcDsaKeyFactory extends PKCS11KeyFactory
java.security.spec.X509EncodedKeySpec
) For private keys, it handles PKCS#8 encoded
key specs (java.security.spec.PKCS8EncodedKeySpec
). Both key specs must carry ANSI
X9.62 encoded keys internally. This standard is compatible to IEEE 1363 and Certicom Sec 1.Modifier and Type | Field and Description |
---|---|
protected static iaik.asn1.structures.AlgorithmID |
EC_ALGORITHM_ID
Algorithm identifier for subject public key info
|
static iaik.asn1.INTEGER |
EC_PRIVATE_KEY_VERSION
The version field in the ASN.1 encoding of the private key (SEC standard).
|
protected static java.lang.String |
KEY_FACTORY_ALGORITHM_NAME
The JCA standard name of this signature algorithm.
|
protected static iaik.asn1.ObjectID |
OBJECT_ID_EC_KEY
This object identifier names the public key type defined in the X9.62 standard
|
pkcs11KeySpec_, pkcs11OperationInitialized_, PKCS8_VERSION, session_, softwareDelegate_, tokenManager_
Constructor and Description |
---|
EcDsaKeyFactory()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected static boolean |
checkJdk16AndEccelerate()
check if JDK 1.5 is used and IAIK ECCelerate is in classpath and set isJdk16AndEccelerate.
|
protected java.security.PrivateKey |
createECPrivateKey(byte[] encodedParameters,
byte[] encodedPrivateKeyValue)
Creates a new PKCS#11 EC private key for the given parameters and encoding.
|
protected java.security.PublicKey |
createECPublicKey(byte[] encodedParameters,
byte[] encodedPublicKeyValue)
Creates a new PKCS#11 EC public key for the given parameters and encoding.
|
protected java.lang.String |
getAlgorithmName()
Return the JCA standard name of this key factory algorithm.
|
protected java.lang.String |
getSoftwareDelegateAlgorithm()
Return the name of the software algorithm to use, if this object must use a software delegation
object.
|
protected java.security.PrivateKey |
pkcs11GeneratePrivate(java.security.spec.KeySpec keySpec)
Generates a private key object from the provided key specification (key material).
|
protected java.security.PublicKey |
pkcs11GeneratePublic(java.security.spec.KeySpec keySpec)
Generates a public key object from the provided key specification (key material).
|
protected java.security.spec.KeySpec |
pkcs11GetKeySpec(java.security.Key key,
java.lang.Class keySpecClass)
Returns a specification (key material) of the given key object.
|
protected void |
verifyPrivateKeyExtractable(iaik.pkcs.pkcs11.objects.ECDSAPrivateKey key)
Verifies that the components of the key are present and extractable; i.e.
|
protected void |
verifyPublicKeyExtractable(iaik.pkcs.pkcs11.objects.ECDSAPublicKey key)
Verifies that the components of the key are present and extractable; i.e.
|
createKey, engineGeneratePrivate, engineGeneratePublic, engineGetKeySpec, engineTranslateKey, finalize, finalizePkcs11Operation, initializePkcs11Operation, initializeSession, initializeSoftwareDelegate, isSessionAppropriate, isSupportedBy, pkcs11TranslateKey
protected static java.lang.String KEY_FACTORY_ALGORITHM_NAME
protected static final iaik.asn1.ObjectID OBJECT_ID_EC_KEY
protected static final iaik.asn1.structures.AlgorithmID EC_ALGORITHM_ID
public static final iaik.asn1.INTEGER EC_PRIVATE_KEY_VERSION
protected static boolean checkJdk16AndEccelerate()
protected java.lang.String getSoftwareDelegateAlgorithm()
getSoftwareDelegateAlgorithm
in class PKCS11KeyFactory
protected java.lang.String getAlgorithmName()
getAlgorithmName
in class PKCS11KeyFactory
protected java.security.PublicKey pkcs11GeneratePublic(java.security.spec.KeySpec keySpec) throws java.security.spec.InvalidKeySpecException
pkcs11GeneratePublic
in class PKCS11KeyFactory
keySpec
- the specification (key material) of the public key.java.security.spec.InvalidKeySpecException
- if the given key specification is inappropriate for this key factory to produce a
public key.protected java.security.PublicKey createECPublicKey(byte[] encodedParameters, byte[] encodedPublicKeyValue) throws java.security.spec.InvalidKeySpecException
encodedParameters
- the parameters of the keyencodedPublicKeyValue
- the public key valuejava.security.spec.InvalidKeySpecException
protected java.security.PrivateKey pkcs11GeneratePrivate(java.security.spec.KeySpec keySpec) throws java.security.spec.InvalidKeySpecException
pkcs11GeneratePrivate
in class PKCS11KeyFactory
keySpec
- the specification (key material) of the private key.java.security.spec.InvalidKeySpecException
- if the given key specification is inappropriate for this key factory to produce a
private key.protected java.security.PrivateKey createECPrivateKey(byte[] encodedParameters, byte[] encodedPrivateKeyValue) throws java.security.spec.InvalidKeySpecException
encodedParameters
- the parameters of the keyencodedPublicKeyValue
- the private key valuejava.security.spec.InvalidKeySpecException
protected java.security.spec.KeySpec pkcs11GetKeySpec(java.security.Key key, java.lang.Class keySpecClass) throws java.security.spec.InvalidKeySpecException
keySpec
identifies
the specification class in which the key material should be returned. It could, for example, be
PKCS8EncodedKeySpec.class
, to indicate that the private key material should be
returned in an instance of the PKCS8EncodedKeySpec
class.pkcs11GetKeySpec
in class PKCS11KeyFactory
key
- The key.keySpecClass
- The specification class in which the key material should be returned.java.security.spec.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).protected void verifyPublicKeyExtractable(iaik.pkcs.pkcs11.objects.ECDSAPublicKey key) throws NonExtractableComponentException, IAIKPkcs11Exception
key
- The key.NonExtractableComponentException
- If any attribute is sensitive.IAIKPkcs11Exception
- If any attribute is not present.protected void verifyPrivateKeyExtractable(iaik.pkcs.pkcs11.objects.ECDSAPrivateKey key) throws NonExtractableComponentException, IAIKPkcs11Exception
key
- The key.NonExtractableComponentException
- If any attribute is sensitive.IAIKPkcs11Exception
- If any attribute is not present.IAIK JavaSecurity Website https://jce.iaik.tugraz.at/
IAIK at Graz University of Technology, Austria, Europe
Copyright 2001-2023 IAIK, Graz University of Technology, Inffeldgasse 16a, 8010 Graz, Austria. All Rights Reserved. Version 1.9.4