com.ibm.crypto.pkcs11impl.provider
Class GeneralKey

java.lang.Object
  extended by com.ibm.crypto.pkcs11impl.provider.GeneralKey
All Implemented Interfaces:
GeneralPKCS11Key, PKCS11Key, PKCS11SecretKey, java.io.Serializable, java.security.Key, javax.crypto.SecretKey

public final class GeneralKey
extends java.lang.Object
implements GeneralPKCS11Key, java.io.Serializable

A PKCS11 Key

Version:
1.0, 13/1/2005
See Also:
Serialized Form

Method Summary
 java.lang.String getAlgorithm()
          Get Algorithm Name
 java.lang.Boolean getAlwaysSensitive()
          Returns if key is Always Sensitive
 java.lang.Boolean getDecrypt()
          Return can this key do decryption
 java.lang.Boolean getDerive()
          Returns true if key supports key derivation
 byte[] getEncoded()
          Return encoding if available
 java.lang.Boolean getEncrypt()
          Return can this key do encryption
 java.util.Date getEndDate()
          Returns the end date
 java.lang.Boolean getExtractable()
          Returns if this key can be wrapped by another key.
 java.lang.String getFormat()
          Get format which is PKCS#11
 byte[] getID()
          Return the ID
 int getKeySizeInBytes()
          Return the key size in bytes.
 java.lang.Integer getKeyType()
          Return the key type
 java.lang.String getLabel()
          Return the label.
 java.lang.Boolean getLocal()
          Returns true if key was either: 1, generated locally with a C_GenerateKey or C_GenerateKeyPair call 2, created with a C_CopyObject call as a copy of a key which had its CKA_LOCAL attribute set to TRUE
 java.lang.Boolean getModifiable()
          Returns modifiable
 java.lang.Boolean getNeverExtractable()
          Returns if the key is Never Extractable
 com.ibm.pkcs11.PKCS11Object getObject()
          Return the PKCS11Object
 java.lang.Boolean getPrivate()
          Returns if the object is private
 java.lang.Boolean getSensitive()
          Returns the sensitive.
 com.ibm.pkcs11.PKCS11Session getSession()
          Return the session associated with the key.
 java.lang.Boolean getSign()
          Return can this key create a signature
 java.util.Date getStartDate()
          Returns the start date
 java.lang.Boolean getToken()
          Returns if the key is a token
 java.lang.Boolean getUnwrap()
          Returns if this key can unwrap another key.
 byte[] getValue()
          Return the key value, if available.
 int getValueLen()
          Return size of key if available
 java.lang.Boolean getVerify()
          Return if the key supports verifying signatures
 java.lang.Boolean getWrap()
          Returns if this key can wrap another.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getEncoded

public byte[] getEncoded()
Return encoding if available

Specified by:
getEncoded in interface java.security.Key
Returns:
encoding

getValueLen

public int getValueLen()
Return size of key if available

Specified by:
getValueLen in interface GeneralPKCS11Key
Returns:
size of key

getObject

public com.ibm.pkcs11.PKCS11Object getObject()
Return the PKCS11Object

Specified by:
getObject in interface PKCS11Key
Returns:
object

getToken

public java.lang.Boolean getToken()
Returns if the key is a token

Specified by:
getToken in interface PKCS11Key
Returns:
true if object is a token object; false if object is a session object

getPrivate

public java.lang.Boolean getPrivate()
Returns if the object is private

Specified by:
getPrivate in interface PKCS11Key
Returns:
true if object is a private object; false if object is a public object.

getLabel

public java.lang.String getLabel()
Return the label.

Specified by:
getLabel in interface PKCS11Key
Returns:
the label

getModifiable

public java.lang.Boolean getModifiable()
Returns modifiable

Specified by:
getModifiable in interface PKCS11Key
Returns:
true if object can be modified; false otherwise

getKeyType

public java.lang.Integer getKeyType()
Return the key type

Specified by:
getKeyType in interface PKCS11Key
Returns:
the key type

getID

public byte[] getID()
Return the ID

Specified by:
getID in interface PKCS11Key
Returns:
the ID

getStartDate

public java.util.Date getStartDate()
Returns the start date

Specified by:
getStartDate in interface PKCS11Key
Returns:
the start date

getEndDate

public java.util.Date getEndDate()
Returns the end date

Specified by:
getEndDate in interface PKCS11Key
Returns:
the end date

getDerive

public java.lang.Boolean getDerive()
Returns true if key supports key derivation

Specified by:
getDerive in interface PKCS11Key
Returns:
true if key supports key derivation; false otherwise

getLocal

public java.lang.Boolean getLocal()
Returns true if key was either: 1, generated locally with a C_GenerateKey or C_GenerateKeyPair call 2, created with a C_CopyObject call as a copy of a key which had its CKA_LOCAL attribute set to TRUE

Specified by:
getLocal in interface PKCS11Key
Returns:
true if key was either generated locally or created as a copy of a key which had its CKA_local sttribute set to TRUE

getSensitive

public java.lang.Boolean getSensitive()
Returns the sensitive.

Specified by:
getSensitive in interface PKCS11SecretKey
Returns:
if the key is sensitive

getEncrypt

public java.lang.Boolean getEncrypt()
Return can this key do encryption

Specified by:
getEncrypt in interface PKCS11SecretKey
Returns:
Boolean of value true if the key supports encryption null if this is not specified

getDecrypt

public java.lang.Boolean getDecrypt()
Return can this key do decryption

Specified by:
getDecrypt in interface PKCS11SecretKey
Returns:
Boolean of value true if the key supports decryption null if this is not specified

getSign

public java.lang.Boolean getSign()
Return can this key create a signature

Returns:
Boolean of value true if the key supports signing null if this is not specified

getVerify

public java.lang.Boolean getVerify()
Return if the key supports verifying signatures

Specified by:
getVerify in interface PKCS11SecretKey
Returns:
Boolean of value true if the key supports verifying null if this is not specified

getWrap

public java.lang.Boolean getWrap()
Returns if this key can wrap another.

Specified by:
getWrap in interface PKCS11SecretKey
Returns:
true if key supports wrapping; null if not specified

getUnwrap

public java.lang.Boolean getUnwrap()
Returns if this key can unwrap another key.

Specified by:
getUnwrap in interface PKCS11SecretKey
Returns:
true if key supports wrapping; null if not specified

getExtractable

public java.lang.Boolean getExtractable()
Returns if this key can be wrapped by another key.

Returns:
true if key can be wrapped; null if not specified.

getAlwaysSensitive

public java.lang.Boolean getAlwaysSensitive()
Returns if key is Always Sensitive

Specified by:
getAlwaysSensitive in interface PKCS11SecretKey
Returns:
true if key is Always Sensitive; null if not specified

getNeverExtractable

public java.lang.Boolean getNeverExtractable()
Returns if the key is Never Extractable

Specified by:
getNeverExtractable in interface PKCS11SecretKey
Returns:
true if key is Never Extractable; null if not specified

getValue

public byte[] getValue()
Return the key value, if available.

Specified by:
getValue in interface GeneralPKCS11Key
Returns:
the key.

getKeySizeInBytes

public int getKeySizeInBytes()
Return the key size in bytes.


getSession

public com.ibm.pkcs11.PKCS11Session getSession()
Return the session associated with the key.

Specified by:
getSession in interface PKCS11Key
Returns:
the session associated with the key

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getFormat

public java.lang.String getFormat()
Get format which is PKCS#11

Specified by:
getFormat in interface java.security.Key

getAlgorithm

public java.lang.String getAlgorithm()
Get Algorithm Name

Specified by:
getAlgorithm in interface java.security.Key