public class CkiSymmetricKey
extends SymmetricKey
implements java.lang.Cloneable
Constructor and Description |
---|
CkiSymmetricKey()
Empty constructor.
|
CkiSymmetricKey(byte[] keyBytes,
AlgorithmIdentifier algID,
boolean tokenPersistent)
Creates a new CkiSymmetricKey object with the value of the key and the cipher's algorithm
identifier corresponding to the key.
|
CkiSymmetricKey(byte[] keyBytes,
CkiSession session,
AlgorithmIdentifier algID,
boolean tokenPersistent)
Creates a new CkiSymmetricKey object with the given session with the value of the key and the cipher's algorithm
identifier corresponding to the key.
|
CkiSymmetricKey(byte[] keyBytes,
CkiSlot slot,
AlgorithmIdentifier algID,
boolean tokenPersistent)
Creates a new CkiSymmetricKey object on the given slot with the value of the key and the cipher's algorithm
identifier corresponding to the key.
|
CkiSymmetricKey(CkiSession session,
byte[] keyID)
Creates a new CkiSymmetricKey object from an existant key on a token.
|
CkiSymmetricKey(CkiSession session,
CkiObject ckiObject)
Creates a new CkiSymmetricKey object.
|
CkiSymmetricKey(CkiSession session,
CkiObject ckiObject,
AlgorithmIdentifier algID,
byte[] keyID) |
CkiSymmetricKey(CkiSlot slot,
byte[] keyID)
Creates a new CkiSymmetricKey object from an existant key on a token.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Creates a deep copy of this
SymmetricKey instance. |
void |
erase()
Makes this CkiSymmetricKey unusable.
|
void |
finalize() |
AlgorithmIdentifier |
getAlgID()
Returns the
AlgorithmIdentifier for this key. |
java.lang.String |
getAlgorithm()
Deprecated.
|
byte[] |
getBytes()
Gets the actual bytes of the key.
|
CkiObject |
getCkiObject()
Returns the CkiObject used by this CkiSymmetricKey.
|
java.lang.String |
getFormat()
Returns the format used in this key's encoding.
|
byte[] |
getKeyID()
Gets the keyID of this CkiSymmetricKey object.
|
java.lang.String |
getLabel()
Retrieves the label of this CkiSymmetricKey passed in parameter
|
CkiSession |
getSession()
Returns the CkiSession used by this CkiSymmetricKey.
|
CkiSlot |
getSlot()
Gets the cki slot corresponding to this CkiSymmetricKey object.
|
int |
keySize()
Returns the length of the key in bytes.
|
void |
removeWhenErase(boolean removeWhenErase)
Sets a flag that is used when the
erase() method is called. |
void |
setBytes(byte[] key)
Sets the actual bytes of the key.
|
void |
setKeyID(byte[] keyID)
Sets the keyID of this CkiSymmetricKey object.
|
void |
setLabel(java.lang.String label)
Sets the label of this CkiSymmetricKey passed in parameter
|
void |
setSlot(CkiSlot slot)
Sets the CkiSlot of this CkiSymmetricKey.
|
java.lang.String |
toString()
Returns a description of this CkiSymmetricKey.
|
public CkiSymmetricKey()
public CkiSymmetricKey(byte[] keyBytes, AlgorithmIdentifier algID, boolean tokenPersistent) throws CryptokiException
keyBytes
- The value of the symmetric key.algID
- The algorithm identifier representing the cipher that will be used with the key.tokenPersistent
- If false the key will be destroyed when the session will logout.CryptokiException
public CkiSymmetricKey(byte[] keyBytes, CkiSlot slot, AlgorithmIdentifier algID, boolean tokenPersistent) throws CryptokiException
keyBytes
- The value of the symmetric key.slot
- The slot to create the key.algID
- The algorithm identifier representing the cipher that will be used with the key.tokenPersistent
- If false the key will be destroyed when the session will logout.CryptokiException
public CkiSymmetricKey(byte[] keyBytes, CkiSession session, AlgorithmIdentifier algID, boolean tokenPersistent) throws CryptokiException
keyBytes
- The value of the symmetric key.session
- The session to use to create the key.algID
- The algorithm identifier representing the cipher that will be used with the key.tokenPersistent
- If false the key will be destroyed when the session will logout.CryptokiException
public CkiSymmetricKey(CkiSlot slot, byte[] keyID)
slot
- The ckislot where the key can be found.keyID
- The keyID of the key.public CkiSymmetricKey(CkiSession session, byte[] keyID)
session
- The CkiSession to use to find the key.keyID
- The keyID of the key.public CkiSymmetricKey(CkiSession session, CkiObject ckiObject) throws CryptokiException
session
- The CkiSession object.ckiObject
- The CkiObject pointing to the object on the token within the session.CryptokiException
public CkiSymmetricKey(CkiSession session, CkiObject ckiObject, AlgorithmIdentifier algID, byte[] keyID) throws CryptokiException
CryptokiException
public byte[] getKeyID()
public void setKeyID(byte[] keyID) throws CryptokiException
keyID
- The new key ID.CryptokiException
public void setLabel(java.lang.String label) throws CryptokiException
label
- The new label.CryptokiException
public java.lang.String getLabel() throws CryptokiException
byte[]
CryptokiException
public void setSlot(CkiSlot slot)
public CkiSlot getSlot()
public CkiSession getSession() throws CryptokiException
CryptokiException
public CkiObject getCkiObject() throws CryptokiException
CryptokiException
public java.lang.String getAlgorithm()
public int keySize()
public void setBytes(byte[] key)
public byte[] getBytes()
public java.lang.String getFormat()
public AlgorithmIdentifier getAlgID()
AlgorithmIdentifier
for this key.public java.lang.String toString()
public void erase()
public void finalize()
public void removeWhenErase(boolean removeWhenErase)
erase()
method is called.removeWhenErase
- If the flag is true
, this CkiPrivateKey
will
be removed from the token when the erase()
method will be called.public java.lang.Object clone()
SymmetricKey
instance.