Package org.mozilla.jss.crypto
Class KBKDFParameterSpec
java.lang.Object
org.mozilla.jss.util.NativeEnclosure
org.mozilla.jss.crypto.KBKDFParameterSpec
- All Implemented Interfaces:
AutoCloseable,AlgorithmParameterSpec,KeySpec
- Direct Known Subclasses:
KBKDFCounterParams,KBKDFFeedbackParams,KBKDFPipelineParams
public abstract class KBKDFParameterSpec
extends NativeEnclosure
implements AlgorithmParameterSpec, KeySpec
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected KBKDFDerivedKey[]longintprotected KBKDFDataParameter[]protected longFields inherited from class org.mozilla.jss.util.NativeEnclosure
mPointer, mPointerSize -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAllocate native resources, setting mPointer and mPointerSize as appropriate.protected abstract voidvoidaddAdditionalDerivedKey(KBKDFDerivedKey derived_key) Append (to the end) a new derived key.voidaddParameter(KBKDFDataParameter param) Appends (to the end) a new data parameter.protected voidCalled to deallocate native resources; note that mPointer.close() is called afterwards.protected abstract voidvoidsetAdditionalDerivedKeys(KBKDFDerivedKey[] additional_keys) Set an array of additional derived keys.voidsetDerivedKeyAlgorithm(long algo) Sets the algorithm for the derived key from a PKCS#11 value; see org.mozilla.jss.pkcs11.PKCS11Constants for constant values.voidSet the algorithm for the derived key from a PKCS11Algorithm enum value.voidsetKeySize(int keySize) Set the size of the derived key.voidsetParameters(KBKDFDataParameter[] params) Set parameters for key derivation.voidsetPRF(long prf) Set the underlying pseudo-random function from a PKCS#11 constant; see org.mozilla.jss.pkcs11.PKCS11Constants for permitted values.voidsetPRF(DigestAlgorithm prf) Set the underlying pseudo-random function from a DigestAlgorithm (HMACAlgorithm or CMACAlgorithm) instance.voidsetPRF(PKCS11Algorithm prf) Set the underlying pseudo-random function from a PKCS11Algorithm enum value.voidSet the base key used with the underlying PRF.protected abstract voidValidate all class members prior to acquiring native resources.Methods inherited from class org.mozilla.jss.util.NativeEnclosure
close, finalize, open
-
Field Details
-
prfKey
-
derivedKeyAlgorithm
public long derivedKeyAlgorithm -
keySize
public int keySize -
prf
protected long prf -
params
-
additional_keys
-
-
Constructor Details
-
KBKDFParameterSpec
public KBKDFParameterSpec()
-
-
Method Details
-
setPRF
Set the underlying pseudo-random function from a PKCS11Algorithm enum value.- Throws:
IllegalArgumentException
-
setPRF
Set the underlying pseudo-random function from a DigestAlgorithm (HMACAlgorithm or CMACAlgorithm) instance.- Throws:
IllegalArgumentException
-
setPRF
public void setPRF(long prf) Set the underlying pseudo-random function from a PKCS#11 constant; see org.mozilla.jss.pkcs11.PKCS11Constants for permitted values. -
setPRFKey
Set the base key used with the underlying PRF. Must be importable to a JSS SymmetricKey or SecretKeyFacade.- Throws:
InvalidKeyException
-
setDerivedKeyAlgorithm
Set the algorithm for the derived key from a PKCS11Algorithm enum value.- Throws:
IllegalArgumentException
-
setDerivedKeyAlgorithm
Sets the algorithm for the derived key from a PKCS#11 value; see org.mozilla.jss.pkcs11.PKCS11Constants for constant values.- Throws:
IllegalArgumentException
-
setKeySize
public void setKeySize(int keySize) Set the size of the derived key. If zero, will attempt to use the derived key algorithm's default key size. -
setParameters
Set parameters for key derivation. This overwrites all existing parameters. Note that params cannot be NULL.- Throws:
IllegalArgumentException
-
addParameter
Appends (to the end) a new data parameter.- Throws:
IllegalArgumentException
-
setAdditionalDerivedKeys
public void setAdditionalDerivedKeys(KBKDFDerivedKey[] additional_keys) throws IllegalArgumentException Set an array of additional derived keys.- Throws:
IllegalArgumentException
-
addAdditionalDerivedKey
Append (to the end) a new derived key.- Throws:
IllegalArgumentException
-
acquireNativeResources
Description copied from class:NativeEnclosureAllocate native resources, setting mPointer and mPointerSize as appropriate.- Specified by:
acquireNativeResourcesin classNativeEnclosure- Throws:
Exception
-
releaseNativeResources
Description copied from class:NativeEnclosureCalled to deallocate native resources; note that mPointer.close() is called afterwards. If mPointer.close() should be a no-op, extend from StaticVoidRef and do any required cleanup here.- Specified by:
releaseNativeResourcesin classNativeEnclosure- Throws:
Exception
-
acquireNativeResourcesInternal
- Throws:
Exception
-
releaseNativeResourcesInternal
- Throws:
Exception
-
validateParameters
Validate all class members prior to acquiring native resources. This is implemented by the derived KBKDF modes in an effort to give useful exceptions before derivation, instead of vague errors during derivation.- Throws:
IllegalArgumentException
-