public class ValuedSecretKey extends SecretKey
Key.KeyType, Key.VendorDefinedKeyBuilderPKCS11Object.ObjectClass, PKCS11Object.VendorDefinedObjectBuilder| Modifier and Type | Field and Description |
|---|---|
protected ByteArrayAttribute |
value
The value attribute of this secret key.
|
protected LongAttribute |
valueLen
The length of this secret key in bytes.
|
alwaysSensitive, checkValue, decrypt, encrypt, extractable, neverExtractable, sensitive, sign, trusted, unwrap, unwrapTemplate, verify, wrap, wrapTemplate, wrapWithTrustedallowedMechanisms, derive, endDate, id, keyGenMechanism, keyType, keyTypeNames, local, startDatelabel, modifiable, private_, tokenattributeTable, objectClass, objectClassNames, objectHandle, vendorObjectBuilder| Modifier | Constructor and Description |
|---|---|
|
ValuedSecretKey(long keyType)
Default Constructor.
|
protected |
ValuedSecretKey(Session session,
long objectHandle,
long keyType)
Called by getInstance to create an instance of a PKCS#11 secret key.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
allocateAttributes()
Allocates the attribute objects for this class and adds them to the
attribute table.
|
boolean |
equals(Object otherObject)
Compares all member variables of this object with the other object.
|
static PKCS11Object |
getInstance(Session session,
long objectHandle,
long keyType)
The getInstance method of the SecretKey class uses this method to create
an instance of a PKCS#11 AES secret key.
|
ByteArrayAttribute |
getValue()
Gets the value attribute of this AES key.
|
LongAttribute |
getValueLen()
Gets the value length attribute of this AES key (in bytes).
|
static ValuedSecretKey |
newAESSecretKey() |
static ValuedSecretKey |
newDES3SecretKey() |
static ValuedSecretKey |
newGenericSecretKey() |
static ValuedSecretKey |
newSM4SecretKey(Module module) |
protected static void |
putAttributesInTable(ValuedSecretKey object)
Put all attributes of the given object into the attributes table of this
object.
|
void |
readAttributes(Session session)
Read the values of the attributes of this object from the token.
|
String |
toString()
Returns a string representation of the current object.
|
getAlwaysSensitive, getCheckValue, getDecrypt, getEncrypt, getExtractable, getInstance, getNeverExtractable, getSensitive, getSign, getTrusted, getUnknownSecretKey, getUnwrap, getUnwrapTemplate, getVerify, getWrap, getWrapTemplate, getWrapWithTrusted, putAttributesInTablegetAllowedMechanisms, getDerive, getEndDate, getId, getKeyGenMechanism, getKeyType, getKeyTypeName, getLocal, getStartDate, hashCode, putAttributesInTablegetLabel, getModifiable, getPrivate, getToken, putAttributesInTablegetAttribute, getAttributeTable, getAttributeValue, getAttributeValues, getObjectClass, getObjectClassName, getObjectHandle, getSetAttributes, getSetAttributes, getUnknownObject, getVendorDefinedObjectBuilder, putAttribute, putAttributesInTable, removeAttribute, setObjectHandle, setVendorDefinedObjectBuilder, toStringprotected ByteArrayAttribute value
protected LongAttribute valueLen
public ValuedSecretKey(long keyType)
keyType - The type of the key.protected ValuedSecretKey(Session session, long objectHandle, long keyType) throws TokenException
session - The session to use for reading attributes. This session must
have the appropriate rights; i.e. it must be a user-session, if
it is a private object.objectHandle - The object handle as given from the PKCS#111 module.keyType - The type of the key.TokenException - If getting the attributes failed.public static ValuedSecretKey newAESSecretKey()
public static ValuedSecretKey newDES3SecretKey()
public static ValuedSecretKey newGenericSecretKey()
public static ValuedSecretKey newSM4SecretKey(Module module)
public static PKCS11Object getInstance(Session session, long objectHandle, long keyType) throws TokenException
session - The session to use for reading attributes. This session must
have the appropriate rights; i.e. it must be a user-session, if
it is a private object.objectHandle - The object handle as given from the PKCS#111 module.keyType - The type of the key.TokenException - If getting the attributes failed.protected static void putAttributesInTable(ValuedSecretKey object)
object - The object to handle.protected void allocateAttributes()
allocateAttributes in class SecretKeypublic boolean equals(Object otherObject)
public ByteArrayAttribute getValue()
public LongAttribute getValueLen()
public void readAttributes(Session session) throws TokenException
readAttributes in class SecretKeysession - The session to use for reading attributes. This session must
have the appropriate rights; i.e. it must be a user-session, if
it is a private object.TokenException - If getting the attributes failed.Copyright © 2022. All rights reserved.