public abstract class SecretKeyFactory extends PKCS11SecretKeyFactory
pkcs11KeySpec_, pkcs11OperationInitialized_, session_, softwareDelegate_, tokenManager_
Constructor and Description |
---|
SecretKeyFactory()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected abstract iaik.pkcs.pkcs11.objects.Object |
createKeyCreationTemplate(java.security.spec.KeySpec secretKeySpec)
Create the key template to use as input for the object creation.
|
protected byte[] |
extractKeyMaterial(iaik.pkcs.pkcs11.objects.Key keyObject)
Get the key material of the given key object.
|
protected java.lang.String |
getSoftwareDelegateAlgorithm()
Return the name of the software algorithm to use, if this object must use a software delegation
object.
|
protected abstract boolean |
isAlgorithmAccepted(java.lang.String algorithmName)
Check, if this factory can handle keys of the algorithm given by its name.
|
protected boolean |
isFormatAccepted(java.lang.String formatName)
Check, if this factory can handle keys encoded in the given format.
|
protected javax.crypto.SecretKey |
pkcs11GenerateSecret(java.security.spec.KeySpec keySpec)
Converts the given key specification (key material) into a SecretKey object.
|
protected java.security.spec.KeySpec |
pkcs11GetKeySpec(javax.crypto.SecretKey key,
java.lang.Class keySpecClass)
Returns a specification (key material) of the given key object.
|
protected void |
validateKeySpec(java.security.spec.KeySpec keySpec)
Check, if this factory can handle the given key specification.
|
createKey, engineGenerateSecret, engineGetKeySpec, engineTranslateKey, finalize, finalizePkcs11Operation, getAlgorithmName, initializePkcs11Operation, initializeSession, initializeSoftwareDelegate, isSessionAppropriate, isSupportedBy, pkcs11TranslateKey
protected abstract iaik.pkcs.pkcs11.objects.Object createKeyCreationTemplate(java.security.spec.KeySpec secretKeySpec) throws java.security.spec.InvalidKeySpecException
secretKeySpec
- The key spec providing algorithm specific key attributes.java.security.spec.InvalidKeySpecException
- If the given key material is inappropriate for this factory.protected javax.crypto.SecretKey pkcs11GenerateSecret(java.security.spec.KeySpec keySpec) throws java.security.spec.InvalidKeySpecException
pkcs11GenerateSecret
in class PKCS11SecretKeyFactory
keySpec
- the specification (key material) to be converted into SecretKey representation.java.security.spec.InvalidKeySpecException
- if the given key material cannot be converted into a SecretKey object by this key
factorySecretKeyFactorySpi.engineGenerateSecret(KeySpec)
protected java.security.spec.KeySpec pkcs11GetKeySpec(javax.crypto.SecretKey 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
DHPublicKeySpec.class
, to indicate that the key material should be returned in an
instance of the DHPublicKeySpec
class.pkcs11GetKeySpec
in class PKCS11SecretKeyFactory
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 byte[] extractKeyMaterial(iaik.pkcs.pkcs11.objects.Key keyObject) throws java.security.spec.InvalidKeySpecException, NonExtractableComponentException, IAIKPkcs11Exception
keyObject
- The key.java.security.spec.InvalidKeySpecException
- If the key object is not accepted by this factory.NonExtractableComponentException
- If any attribute is sensitive.IAIKPkcs11Exception
- If any attribute is not present.protected java.lang.String getSoftwareDelegateAlgorithm()
getSoftwareDelegateAlgorithm
in class PKCS11SecretKeyFactory
protected abstract boolean isAlgorithmAccepted(java.lang.String algorithmName)
algorithmName
- The name of the key algorithm.protected boolean isFormatAccepted(java.lang.String formatName)
formatName
- The name of the encoding.protected void validateKeySpec(java.security.spec.KeySpec keySpec) throws java.security.spec.InvalidKeySpecException
InvalidKeySpecException
if the given keySpec
is invalid.keySpec
- The key specification.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).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