com.ibm.crypto.pkcs11impl.provider
Class DSAPrivateKey
- java.lang.Object
-
- com.ibm.security.pkcsutil.PKCSDerObject
-
- com.ibm.security.pkcs8.PrivateKeyInfo
-
- com.ibm.crypto.pkcs11impl.provider.DSAPrivateKey
-
- All Implemented Interfaces:
- PKCS11DSAPrivateKey, PKCS11Key, PKCS11PrivateKey, com.ibm.pkcs11.P11Key, java.io.Serializable, java.lang.Cloneable, java.security.interfaces.DSAKey, java.security.interfaces.DSAPrivateKey, java.security.Key, java.security.PrivateKey, javax.security.auth.Destroyable
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
-
-
Constructor Summary
Constructors Constructor and Description DSAPrivateKey(Session session, com.ibm.pkcs11.PKCS11Object object)DSAPrivateKey(Session 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
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.lang.StringgetAlgorithm()Get algorithm which is DSAjava.lang.BooleangetAlwaysSensitive()Return if the key is AlwaysSensitivejava.lang.IntegergetAuthPinFlags()Returns the auth pin flagsjava.math.BigIntegergetBase()Return the base.java.lang.BooleangetDecrypt()Return if the key can do decryptionjava.lang.BooleangetDerive()Returns true if key supports key derivationjava.util.DategetEndDate()Returns the end datejava.lang.BooleangetExtractable()Return if the key is extractablejava.lang.StringgetFormat()Get format which is PKCS#11byte[]getID()Return the IDjava.lang.IntegergetKeyType()Return the key typejava.lang.StringgetLabel()Return the label.java.lang.BooleangetLocal()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 TRUEjava.lang.BooleangetModifiable()Returns if the key has modifiable attributes.java.lang.BooleangetNeverExtractable()Return if the key is Never Extractablecom.ibm.pkcs11.PKCS11ObjectgetObject()Returns the PKCS#11 objectjava.security.interfaces.DSAParamsgetParams()Returns the DSA parameters associated with this key, or null if the parameters could not be parsed.java.math.BigIntegergetPrime()Return the prime.java.lang.BooleangetPrivate()Returns if the key is privatejava.lang.BooleangetSecondaryAuth()Returns if the key requires secondary authenticationjava.lang.BooleangetSensitive()Returns if the key is sensitiveSessiongetSession()Return the session associated with the key.SessionManagergetSessionManager()Returns the session manager associated with the keyjava.lang.BooleangetSign()Return if the key can create a signaturejava.lang.BooleangetSignRecover()Return if the key supports sign recoverjava.util.DategetStartDate()Returns the start datebyte[]getSubject()Return the subject in DER encoding byte arrayjava.math.BigIntegergetSubprime()Returns the subprime.java.lang.BooleangetToken()Returns if the key is a tokenjava.lang.BooleangetUnwrap()Return if the key can unwrap another.java.math.BigIntegergetValue()Returns the value.java.math.BigIntegergetX()Return the value of the private key.voidrm()Delete the hardware key object and release the session associated with this PKCS11 keyvoidsetKeyAsToken(boolean token)Sets the token attribute within a Java software 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, toString
-
-
-
-
Constructor Detail
-
DSAPrivateKey
public DSAPrivateKey(Session 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 keyobject- the PKCS11 object that is the actaully representation of the key to the hardware.ID- The identifier for this key.subject- DER encoding byte array of the Subject of this keylabel- Label of this keyisToken- Is this key a token?isSensitive- Is this key sensitive?isExtractable- Can this key be wrapped by another?prime- P of the DSA parameterssubprime- Q of the DSA Parametersbase- G of the DSA Parametersvalue- Private key value.- Throws:
java.security.InvalidKeyException
-
DSAPrivateKey
public DSAPrivateKey(Session session, com.ibm.pkcs11.PKCS11Object object) throws java.security.InvalidKeyException
- Throws:
java.security.InvalidKeyException
-
-
Method Detail
-
getObject
public com.ibm.pkcs11.PKCS11Object getObject()
Returns the PKCS#11 object
-
getToken
public java.lang.Boolean getToken()
Returns if the key is a token
-
getPrivate
public java.lang.Boolean getPrivate()
Returns if the key is private- Specified by:
getPrivatein interfacePKCS11Key- Specified by:
getPrivatein interfacecom.ibm.pkcs11.P11Key- Returns:
- true if object is a private object; false if object is a public object.
-
getLabel
public java.lang.String getLabel()
Return the label.
-
getModifiable
public java.lang.Boolean getModifiable()
Returns if the key has modifiable attributes.- Specified by:
getModifiablein interfacePKCS11Key- Specified by:
getModifiablein interfacecom.ibm.pkcs11.P11Key- Returns:
- true if object can be modified; false otherwise
-
getKeyType
public java.lang.Integer getKeyType()
Return the key type- Specified by:
getKeyTypein interfacePKCS11Key- Specified by:
getKeyTypein interfacecom.ibm.pkcs11.P11Key- Returns:
- the key type
-
getID
public byte[] getID()
Return the ID
-
getStartDate
public java.util.Date getStartDate()
Returns the start date- Specified by:
getStartDatein interfacePKCS11Key- Specified by:
getStartDatein interfacecom.ibm.pkcs11.P11Key- Returns:
- the start date
-
getEndDate
public java.util.Date getEndDate()
Returns the end date- Specified by:
getEndDatein interfacePKCS11Key- Specified by:
getEndDatein interfacecom.ibm.pkcs11.P11Key- Returns:
- the end date
-
rm
public void rm()
Delete the hardware key object and release the session associated with this PKCS11 key
-
getDerive
public java.lang.Boolean getDerive()
Returns true if key supports key derivation
-
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
-
getSubject
public byte[] getSubject()
Return the subject in DER encoding byte array- Specified by:
getSubjectin interfacePKCS11PrivateKey- Returns:
- the subject
-
getSensitive
public java.lang.Boolean getSensitive()
Returns if the key is sensitive- Specified by:
getSensitivein interfacePKCS11PrivateKey- Returns:
- true if sensitive; false otherwise
-
getSecondaryAuth
public java.lang.Boolean getSecondaryAuth()
Returns if the key requires secondary authentication- Specified by:
getSecondaryAuthin interfacePKCS11PrivateKey- Returns:
- true if the key does require secondary authentication; false otherwise
-
getAuthPinFlags
public java.lang.Integer getAuthPinFlags()
Returns the auth pin flags- Specified by:
getAuthPinFlagsin interfacePKCS11PrivateKey- 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:
getDecryptin interfacePKCS11PrivateKey- 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:
getSignin interfacePKCS11PrivateKey- 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:
getSignRecoverin interfacePKCS11PrivateKey- 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:
getUnwrapin interfacePKCS11PrivateKey- Returns:
- true if key supports unwrapping; false otherwise;
-
getExtractable
public java.lang.Boolean getExtractable()
Return if the key is extractable- Specified by:
getExtractablein interfacePKCS11PrivateKey- 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:
getAlwaysSensitivein interfacePKCS11PrivateKey- 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:
getNeverExtractablein interfacePKCS11PrivateKey- 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:
getPrimein interfacePKCS11DSAPrivateKey- Returns:
- the prime.
-
getSubprime
public java.math.BigInteger getSubprime()
Returns the subprime.- Specified by:
getSubprimein interfacePKCS11DSAPrivateKey- Returns:
- the subprime.
-
getBase
public java.math.BigInteger getBase()
Return the base.- Specified by:
getBasein interfacePKCS11DSAPrivateKey- Returns:
- the base.
-
getValue
public java.math.BigInteger getValue()
Returns the value.- Specified by:
getValuein interfacePKCS11DSAPrivateKey- Returns:
- the value, if available.
-
getX
public java.math.BigInteger getX()
Return the value of the private key.- Specified by:
getXin interfacejava.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:
getParamsin interfacejava.security.interfaces.DSAKey- Returns:
- DSAParams the DSA parameter of this instance
-
getSession
public Session getSession()
Return the session associated with the key.
-
getFormat
public java.lang.String getFormat()
Get format which is PKCS#11- Specified by:
getFormatin interfacejava.security.Key- Overrides:
getFormatin classcom.ibm.security.pkcs8.PrivateKeyInfo
-
getAlgorithm
public java.lang.String getAlgorithm()
Get algorithm which is DSA- Specified by:
getAlgorithmin interfacejava.security.Key- Overrides:
getAlgorithmin classcom.ibm.security.pkcs8.PrivateKeyInfo
-
getSessionManager
public SessionManager getSessionManager()
Description copied from interface:PKCS11KeyReturns the session manager associated with the key- Specified by:
getSessionManagerin interfacePKCS11Key- Returns:
- the session manager associated with the key
-
setKeyAsToken
public void setKeyAsToken(boolean token)
Description copied from interface:PKCS11PrivateKeySets the token attribute within a Java software key- Specified by:
setKeyAsTokenin interfacePKCS11PrivateKey
-
-