com.ibm.crypto.pkcs11impl.provider
Class DSAPrivateKey

java.lang.Object
  extended by com.ibm.security.pkcsutil.PKCSDerObject
      extended by com.ibm.security.pkcs8.PrivateKeyInfo
          extended by com.ibm.crypto.pkcs11impl.provider.DSAPrivateKey
All Implemented Interfaces:
PKCS11DSAPrivateKey, PKCS11Key, PKCS11PrivateKey, java.io.Serializable, java.lang.Cloneable, java.security.interfaces.DSAKey, java.security.interfaces.DSAPrivateKey, java.security.Key, java.security.PrivateKey

public final class DSAPrivateKey
extends com.ibm.security.pkcs8.PrivateKeyInfo
implements PKCS11DSAPrivateKey, java.io.Serializable

A PKCS#11 DSA Private Key

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.ibm.security.pkcs8.PrivateKeyInfo
version
 
Constructor Summary
DSAPrivateKey(com.ibm.pkcs11.PKCS11Session session, com.ibm.pkcs11.PKCS11Object object, java.lang.String label, byte[] ID, byte[] subject, java.lang.Boolean isToken, java.lang.Boolean isSensitive, java.lang.Boolean isExtractable, java.math.BigInteger prime, java.math.BigInteger subprime, java.math.BigInteger base, java.math.BigInteger value)
          Defines a PKCS#11 DSA private key
 
Method Summary
 java.lang.String getAlgorithm()
          Get algorithm which is DSA
 java.lang.Boolean getAlwaysSensitive()
          Return if the key is AlwaysSensitive
 java.lang.Integer getAuthPinFlags()
          Returns the auth pin flags
 java.math.BigInteger getBase()
          Return the base.
 java.lang.Boolean getDecrypt()
          Return if the key can do decryption
 java.lang.Boolean getDerive()
          Returns true if key supports key derivation
 java.util.Date getEndDate()
          Returns the end date
 java.lang.Boolean getExtractable()
          Return if the key is extractable
 java.lang.String getFormat()
          Get format which is PKCS#11
 byte[] getID()
          Return the ID
 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 attrobute set to TRUE
 java.lang.Boolean getModifiable()
          Returns if the key has modifiable attributes.
 java.lang.Boolean getNeverExtractable()
          Return if the key is Never Extractable
 com.ibm.pkcs11.PKCS11Object getObject()
          Returns the PKCS#11 object
 java.security.interfaces.DSAParams getParams()
          Returns the DSA parameters associated with this key, or null if the parameters could not be parsed.
 java.math.BigInteger getPrime()
          Return the prime.
 java.lang.Boolean getPrivate()
          Returns if the key is private
 java.lang.Boolean getSecondaryAuth()
          Returns if the key requires secondary authentication
 java.lang.Boolean getSensitive()
          Returns if the key is sensitive
 com.ibm.pkcs11.PKCS11Session getSession()
          Return the session associated with the key.
 java.lang.Boolean getSign()
          Return if the key can create a signature
 java.lang.Boolean getSignRecover()
          Return if the key supports sign recover
 java.util.Date getStartDate()
          Returns the start date
 byte[] getSubject()
          Return the subject
 java.math.BigInteger getSubprime()
          Returns the subprime.
 java.lang.Boolean getToken()
          Returns if the key is a token
 java.lang.Boolean getUnwrap()
          Return if the key can unwrap another.
 java.math.BigInteger getValue()
          Returns the value.
 java.math.BigInteger getX()
          Return the value of the private key.
 java.lang.String toString()
          Returns a human readable DSA key.
 
Methods inherited from class com.ibm.security.pkcs8.PrivateKeyInfo
addAttribute, addAttributes, clone, encode, equals, getAlgorithmId, getAttribute, getAttributes, getEncoded, getKeyBytes, hasAttribute, hasAttributes, hashCode, parseKey, parseKey
 
Methods inherited from class com.ibm.security.pkcsutil.PKCSDerObject
encode, getObjectIdentifier, write
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.security.Key
getEncoded
 
Methods inherited from interface java.security.Key
getEncoded
 
Methods inherited from interface java.security.Key
getEncoded
 

Constructor Detail

DSAPrivateKey

public DSAPrivateKey(com.ibm.pkcs11.PKCS11Session session,
                     com.ibm.pkcs11.PKCS11Object object,
                     java.lang.String label,
                     byte[] ID,
                     byte[] subject,
                     java.lang.Boolean isToken,
                     java.lang.Boolean isSensitive,
                     java.lang.Boolean isExtractable,
                     java.math.BigInteger prime,
                     java.math.BigInteger subprime,
                     java.math.BigInteger base,
                     java.math.BigInteger value)
              throws java.security.InvalidKeyException
Defines a PKCS#11 DSA private key

Parameters:
session - the PKCS#11 session associated with the key
object - the PKCS11 object that is the actaully representation of the key to the hardware.
ID - The identifier for this key.
subject - Subject of this key
label - Label of this key
isToken - Is this key a token?
isSensitive - Is this key sensitive?
isExtractable - Can this key be wrapped by another?
prime - P of the DSA parameters
subprime - Q of the DSA Parameters
base - G of the DSA Parameters
value - Private key value.
Throws:
java.security.InvalidKeyException
Method Detail

getObject

public com.ibm.pkcs11.PKCS11Object getObject()
Returns the PKCS#11 object

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 key 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 if the key has modifiable attributes.

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 attrobute 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

getSubject

public byte[] getSubject()
Return the subject

Specified by:
getSubject in interface PKCS11PrivateKey
Returns:
the subject

getSensitive

public java.lang.Boolean getSensitive()
Returns if the key is sensitive

Specified by:
getSensitive in interface PKCS11PrivateKey
Returns:
true if sensitive; false otherwise

getSecondaryAuth

public java.lang.Boolean getSecondaryAuth()
Returns if the key requires secondary authentication

Specified by:
getSecondaryAuth in interface PKCS11PrivateKey
Returns:
true if the key does require secondary authentication; false otherwise

getAuthPinFlags

public java.lang.Integer getAuthPinFlags()
Returns the auth pin flags

Specified by:
getAuthPinFlags in interface PKCS11PrivateKey
Returns:
mask indicating the current state of the secondary authentication PIN.

getDecrypt

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

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

getSign

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

Specified by:
getSign in interface PKCS11PrivateKey
Returns:
Boolean of value true if the key supports signing null if this is not specified

getSignRecover

public java.lang.Boolean getSignRecover()
Return if the key supports sign recover

Specified by:
getSignRecover in interface PKCS11PrivateKey
Returns:
true if key supports signatures where the data can be recovered from the signature; null otherwise;

getUnwrap

public java.lang.Boolean getUnwrap()
Return if the key can unwrap another.

Specified by:
getUnwrap in interface PKCS11PrivateKey
Returns:
true if key supports unwrapping; false otherwise;

getExtractable

public java.lang.Boolean getExtractable()
Return if the key is extractable

Specified by:
getExtractable in interface PKCS11PrivateKey
Returns:
true if key is can be wrapped by another; false otherwise;

getAlwaysSensitive

public java.lang.Boolean getAlwaysSensitive()
Return if the key is AlwaysSensitive

Specified by:
getAlwaysSensitive in interface PKCS11PrivateKey
Returns:
true if key has always had the CKA_SENSITIVE attribute set to TRUE; false otherwise

getNeverExtractable

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

Specified by:
getNeverExtractable in interface PKCS11PrivateKey
Returns:
true if key has never had the CKA_EXTRACTABLE attribute set to TRUE; null otherwise

getPrime

public java.math.BigInteger getPrime()
Return the prime.

Specified by:
getPrime in interface PKCS11DSAPrivateKey
Returns:
the prime.

getSubprime

public java.math.BigInteger getSubprime()
Returns the subprime.

Specified by:
getSubprime in interface PKCS11DSAPrivateKey
Returns:
the subprime.

getBase

public java.math.BigInteger getBase()
Return the base.

Specified by:
getBase in interface PKCS11DSAPrivateKey
Returns:
the base.

getValue

public java.math.BigInteger getValue()
Returns the value.

Specified by:
getValue in interface PKCS11DSAPrivateKey
Returns:
the value, if available.

getX

public java.math.BigInteger getX()
Return the value of the private key.

Specified by:
getX in interface java.security.interfaces.DSAPrivateKey
Returns:
BigInteger the value of x, if available

getParams

public java.security.interfaces.DSAParams getParams()
Returns the DSA parameters associated with this key, or null if the parameters could not be parsed.

Specified by:
getParams in interface java.security.interfaces.DSAKey
Returns:
DSAParams the DSA parameter of this instance

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()
Returns a human readable DSA key.

Overrides:
toString in class com.ibm.security.pkcs8.PrivateKeyInfo
Returns:
a readable version of the DSA private key.

getFormat

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

Specified by:
getFormat in interface java.security.Key
Overrides:
getFormat in class com.ibm.security.pkcs8.PrivateKeyInfo

getAlgorithm

public java.lang.String getAlgorithm()
Get algorithm which is DSA

Specified by:
getAlgorithm in interface java.security.Key
Overrides:
getAlgorithm in class com.ibm.security.pkcs8.PrivateKeyInfo