public abstract class IAIKPKCS11Key
extends java.lang.Object
implements java.security.Key
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AES
The key algortihm name for AES.
|
protected java.lang.String |
alias_
The chached alias for this key.
|
protected boolean |
autoDestroy_
Dtermines if the associated PKCS#11 key object should be deleted upon object finalization.
|
static java.lang.String |
BATON
The key algortihm name for BATON.
|
static java.lang.String |
BLOWFISH
The key algortihm name for AES.
|
static java.lang.String |
CAST
The key algortihm name for CAST.
|
static java.lang.String |
CAST128
The key algortihm name for CAST128 (=CAST5).
|
static java.lang.String |
CAST3
The key algortihm name for CAST3.
|
static java.lang.String |
CAST5
The key algortihm name for CAST5 (=CAST128).
|
static java.lang.String |
CDMF
The key algortihm name for CDMF.
|
static java.lang.String |
DES
The key algortihm name for DES.
|
static java.lang.String |
DES2
The key algortihm name for DES2.
|
static java.lang.String |
DESede
The key algortihm name for DESede (=DES3).
|
protected boolean |
destroyed_
If this is
true , the object has already been destroyed |
static java.lang.String |
DH
The key algortihm name for DH.
|
static java.lang.String |
DSA
The key algortihm name for DSA.
|
static java.lang.String |
ECDSA
The key algortihm name for ECDSA.
|
static java.lang.String |
GENERIC_SECRET
The key algortihm name for GENERIC_SECRET.
|
static java.lang.String |
IDEA
The key algortihm name for IDEA.
|
static java.lang.String |
JUNIPER
The key algortihm name for JUNIPER.
|
static java.lang.String |
KEA
The key algortihm name for KEA.
|
protected static java.lang.String |
KEY_TYPE_NAME_PROPERTIES
The name of the properties file that holds the names of the PKCS#11 key types.
|
protected iaik.pkcs.pkcs11.objects.Key |
keyObject_
Object handle of the associated PKCS#11 key object.
|
protected static java.util.Map |
keyTypeCodes_
The properties object that holds the mapping from key type names code to their PKCS#11 key type
codes.
|
protected static java.util.Map |
keyTypeNames_
The properties object that holds the mapping from key type code to the name of the PKCS#11 key
type.
|
static java.lang.String |
RC2
The key algortihm name for RC2.
|
static java.lang.String |
RC4
The key algortihm name for RC4.
|
static java.lang.String |
RC5
The key algortihm name for RC5.
|
static java.lang.String |
RSA
The key algortihm name for RSA.
|
protected iaik.pkcs.pkcs11.Session |
session_
This is for chaching sessions of session keys to avoid that they are destroyed when the session
gets closed.
|
static java.lang.String |
SKIPJACK
The key algortihm name for SKIPJACK.
|
protected TokenManager |
tokenManager_
The token where this key resides.
|
static java.lang.String |
TWOFISH
The key algortihm name for AES.
|
static java.lang.String |
VENDOR_DEFINED
The key algortihm name for VENDOR_DEFINED.
|
Modifier | Constructor and Description |
---|---|
protected |
IAIKPKCS11Key(TokenManager tokenManager,
iaik.pkcs.pkcs11.objects.Key keyObject)
Construct a key object that is associated with the given PKCS#11 keyObject on the given token
useing the given session.
|
Modifier and Type | Method and Description |
---|---|
static IAIKPKCS11Key |
create(TokenManager tokenManager,
iaik.pkcs.pkcs11.objects.Key keyObject)
Create a new instance of a IAIKPKCS11Key which's token managed by the given token manager and
is based on the given PKCS#11 key object.
|
void |
destroy()
A call to this method destroys the underlying pkcs#11 key object.
|
void |
finalize()
Tries to release the close-lock of this key's session if there is one.
|
java.lang.String |
getAlgorithm()
The name of the algorthim of this key object; e.g.
|
static java.lang.Long |
getAlgorithmCode(java.lang.String keyTypeName)
Get the code of the algorthim with the given name.
|
static java.lang.String |
getAlgorithmName(int keyTypeCode)
Get the name of the algorthim of the give key type code.
|
java.lang.String |
getAlias()
Get the alias name for this key.
|
byte[] |
getEncoded()
UNSUPPORTED.
|
java.lang.String |
getFormat()
UNSUPPORTED.
|
byte[] |
getKeyID()
Get the ID of this PKCS#11 key object; i.e.
|
iaik.pkcs.pkcs11.objects.Key |
getKeyObject()
Get the associated PKCS#11 key object.
|
iaik.pkcs.pkcs11.Session |
getSession()
The chached session in this key.
|
TokenManager |
getTokenManager()
Get the token manager this object works with.
|
boolean |
isAutoDestroy()
Returns
true if this key object is marked for automatic deletion upon object
finalization. |
boolean |
isDestroyed()
Returns
true , if the destroy() method has already been called
successfully. |
protected static boolean |
jdk16AndEccelerate()
check if JDK 1.6 is used and IAIK ECCelerate is in classpath and set isJdk16AndEccelerate.
|
void |
setAutoDestroy(boolean autoDestroy)
Set if this key object should be deleted automatically upon object finalization.
|
void |
setSession(iaik.pkcs.pkcs11.Session session)
Cache the given session in this key.
|
java.lang.String |
toString()
Returns a string presentation for debug output.
|
public static final java.lang.String RSA
public static final java.lang.String DSA
public static final java.lang.String DH
public static final java.lang.String ECDSA
public static final java.lang.String KEA
public static final java.lang.String GENERIC_SECRET
public static final java.lang.String RC2
public static final java.lang.String RC4
public static final java.lang.String DES
public static final java.lang.String DES2
public static final java.lang.String DESede
public static final java.lang.String CAST
public static final java.lang.String CAST3
public static final java.lang.String CAST5
public static final java.lang.String CAST128
public static final java.lang.String RC5
public static final java.lang.String IDEA
public static final java.lang.String SKIPJACK
public static final java.lang.String BATON
public static final java.lang.String JUNIPER
public static final java.lang.String CDMF
public static final java.lang.String AES
public static final java.lang.String BLOWFISH
public static final java.lang.String TWOFISH
public static final java.lang.String VENDOR_DEFINED
protected static final java.lang.String KEY_TYPE_NAME_PROPERTIES
protected static java.util.Map keyTypeNames_
protected static final java.util.Map keyTypeCodes_
protected TokenManager tokenManager_
protected iaik.pkcs.pkcs11.objects.Key keyObject_
protected java.lang.String alias_
protected iaik.pkcs.pkcs11.Session session_
protected boolean autoDestroy_
protected boolean destroyed_
true
, the object has already been destroyedprotected IAIKPKCS11Key(TokenManager tokenManager, iaik.pkcs.pkcs11.objects.Key keyObject)
tokenManager
- The token manager of the token where this key resides.keyObject
- The PKCS#11 key object.protected static boolean jdk16AndEccelerate()
public static IAIKPKCS11Key create(TokenManager tokenManager, iaik.pkcs.pkcs11.objects.Key keyObject)
tokenManager
- The token manager of the token where the key is.keyObject
- The PKCS#11 key object.public static java.lang.String getAlgorithmName(int keyTypeCode)
keyTypeCode
- The PKCS#11 key type code; e.g. 0x00000000 for RSA.public static java.lang.Long getAlgorithmCode(java.lang.String keyTypeName)
keyTypeName
- The key type name. This may be one of the defined constants in this class or one of
those declared in the key type properties file; e.g. RSA.public void destroy()
public boolean isDestroyed()
true
, if the destroy()
method has already been called
successfully.true
, if the object has alread been destroyed.public java.lang.String getAlgorithm()
getAlgorithm
in interface java.security.Key
public java.lang.String getAlias()
public TokenManager getTokenManager()
public iaik.pkcs.pkcs11.objects.Key getKeyObject()
public byte[] getKeyID()
public byte[] getEncoded()
getEncoded
in interface java.security.Key
public java.lang.String getFormat()
getFormat
in interface java.security.Key
public iaik.pkcs.pkcs11.Session getSession()
public void setSession(iaik.pkcs.pkcs11.Session session)
session
- The cached session or null.public void setAutoDestroy(boolean autoDestroy)
true
and this object gets finalized by the garbage collector, the
finalize()
method of this key object will destroy the underlying PKCS#11 key object.
This is useful especially for keys which are a result of automatic translation to PKCS#11 keys. They are usually no longer used after this object got finalized.
The default value is false
.
autoDestroy
- true
, if the underlying PCKCS#11 key object should be deleted upon object
finalization.public boolean isAutoDestroy()
true
if this key object is marked for automatic deletion upon object
finalization. If this is true
and this object gets finalized by the garbage
collector, the finalize()
method of this key object will destroy the underlying
PKCS#11 key object.
The default value is false
.
true
, if this key is marked for automatic deletion.public java.lang.String toString()
toString
in class java.lang.Object
public void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
- If finalization fails.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