public abstract class SecretKeyTemplate extends KeyTemplate implements javax.crypto.SecretKey
Description:
Template for Secret Keys. Assuming all key have :
CK_ATTRIBUTE(PKCS11Constants.CKA_PRIVATE, true); CK_ATTRIBUTE(PKCS11Constants.CKA_CLASS, PKCS11Constants.CKO_SECRET_KEY); CK_ATTRIBUTE(PKCS11Constants.CKA_VALUE_LEN, getKeySize();
attributes, keyId, label, logger
Modifier | Constructor and Description |
---|---|
protected |
SecretKeyTemplate(java.lang.String label) |
protected |
SecretKeyTemplate(java.lang.String label,
int keySize) |
Modifier and Type | Method and Description |
---|---|
SecretKeyTemplate |
getAsCreationTemplate()
adds CK_ATTRIBUTE(PKCS11Constants.CKA_TOKEN, true)
|
SecretKeyTemplate |
getAsDecryptorTemplate() |
SecretKeyTemplate |
getAsExportableTemplate()
convert to wrapper key template, adds
|
SecretKeyTemplate |
getAsImportTemplate(byte[] value)
Adds as token
|
SecretKeyTemplate |
getAsUnwrapperTemplate()
convert to unwrapper key template,adds
|
SecretKeyTemplate |
getAsWrapperTemplate()
convert to wrapper key template,adds
|
abstract long |
getGenerationMechanism()
Generation mechanism in PKCS11
|
int |
getKeySize() |
boolean |
isWrapperOrUnWrapper() |
add, containsAttribute, getAttribute, getAttributes, getAttributesAsArr, getEncoded, getFormat, getKeyId, getLabel, remove, setKeyId
protected SecretKeyTemplate(java.lang.String label, int keySize)
protected SecretKeyTemplate(java.lang.String label)
public SecretKeyTemplate getAsCreationTemplate()
public SecretKeyTemplate getAsImportTemplate(byte[] value)
CK_ATTRIBUTE(PKCS11Constants.CKA_TOKEN, true) CK_ATTRIBUTE(PKCS11Constants.CKA_VALUE, value)
value
- to import as keypublic SecretKeyTemplate getAsUnwrapperTemplate()
CK_ATTRIBUTE(PKCS11Constants.CKA_TOKEN, false) CK_ATTRIBUTE(PKCS11Constants.CKA_UNWRAP, true)Note: wrapper/unwrapper keys should not be token.
public SecretKeyTemplate getAsWrapperTemplate()
CK_ATTRIBUTE(PKCS11Constants.CKA_TOKEN, false) CK_ATTRIBUTE(PKCS11Constants.CKA_WRAP, true)Note: wrapper/unwrapper keys should not be token.
public boolean isWrapperOrUnWrapper()
public SecretKeyTemplate getAsExportableTemplate()
CK_ATTRIBUTE(PKCS11Constants.CKA_TOKEN, false) CK_ATTRIBUTE(PKCS11Constants.CKA_EXTRACTABLE, true)Note: exportable shall not be token.
public int getKeySize()
public abstract long getGenerationMechanism()
public SecretKeyTemplate getAsDecryptorTemplate()
Copyright © 2025. All rights reserved.