com.ibm.crypto.fips.provider
Class DatawithDSA
- java.lang.Object
-
- java.security.SignatureSpi
-
- java.security.Signature
-
- com.ibm.crypto.fips.provider.DatawithDSA
-
public final class DatawithDSA extends java.security.Signature
-
-
Constructor Summary
Constructors Constructor and Description DatawithDSA()
Constructs a new instance of this class.
-
Method Summary
Methods Modifier and Type Method and Description protected void
checkKey(java.security.interfaces.DSAParams params)
protected java.lang.Object
engineGetParameter(java.lang.String param)
Deprecated.protected void
engineInitSign(java.security.PrivateKey privateKey)
Initialize the receiver with the specified private key, to be used for signing purposes.protected void
engineInitVerify(java.security.PublicKey publicKey)
Initialize the receiver with the specified public key, to be used for verification purposes.protected void
engineSetParameter(java.lang.String param, java.lang.Object value)
Deprecated.Replaced with engineSetParameter(AlgorithmParameterSpec)protected byte[]
engineSign()
Answers the signature bytes of the data updated so far.protected void
engineUpdate(byte b)
Update the bytes signed so far with the extra byte provided.protected void
engineUpdate(byte[] buffer, int offset, int length)
Update the bytes signed so far with the extra bytes provided.protected boolean
engineVerify(byte[] sigBytes)
Verifies the passed signature.protected void
finalize()
This function resets the class variables.protected java.lang.Object
internalGetParameter(java.lang.String param)
Deprecated.protected void
internalInitSign(java.security.PrivateKey privateKey)
Initialize the receiver with the specified private key, to be used for signing purposes.protected void
internalInitVerify(java.security.PublicKey publicKey)
Initialize the receiver with the specified public key, to be used for verification purposes.protected void
internalSetParameter(java.lang.String param, java.lang.Object value)
Deprecated.Replaced with engineSetParameter(AlgorithmParameterSpec)protected byte[]
internalSign()
Answers the signature bytes of the data updated so far.java.lang.String
internalToString()
Answers a string containing a concise, human-readable description of the receiver.protected void
internalUpdate(byte b)
Update the bytes signed so far with the extra byte provided.protected void
internalUpdate(byte[] buffer, int offset, int length)
Update the bytes signed so far with the extra bytes provided.protected boolean
internalVerify(byte[] sigBytes)
Verifies the passed signature.java.lang.String
toString()
Answers a string containing a concise, human-readable description of the receiver.-
Methods inherited from class java.security.Signature
clone, getAlgorithm, getInstance, getInstance, getInstance, getParameter, getParameters, getProvider, initSign, initSign, initVerify, initVerify, setParameter, setParameter, sign, sign, update, update, update, update, verify, verify
-
-
-
-
Constructor Detail
-
DatawithDSA
public DatawithDSA() throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException
Constructs a new instance of this class.- Throws:
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException
-
-
Method Detail
-
engineGetParameter
protected java.lang.Object engineGetParameter(java.lang.String param) throws java.security.InvalidParameterException
Deprecated.Answers the specified algorithm parameter. Since no parameters can be specified, it always throws an exception.- Specified by:
engineGetParameter
in classjava.security.SignatureSpi
- Parameters:
param
- String the parameter name.- Returns:
- the specified algorithm parameter.
- Throws:
java.security.InvalidParameterException
- if the specified parameter name is invalidFIPSRuntimeException
- if SelfTest.isFipsRunnable returns false.
-
internalGetParameter
protected java.lang.Object internalGetParameter(java.lang.String param) throws java.security.InvalidParameterException
Deprecated.Answers the specified algorithm parameter. Since no parameters can be specified, it always throws an exception.- Parameters:
param
- String the parameter name.- Returns:
- the specified algorithm parameter.
- Throws:
java.security.InvalidParameterException
- if the specified parameter name is invalid
-
checkKey
protected void checkKey(java.security.interfaces.DSAParams params) throws java.security.InvalidKeyException
- Throws:
java.security.InvalidKeyException
-
engineInitSign
protected void engineInitSign(java.security.PrivateKey privateKey) throws java.security.InvalidKeyException
Initialize the receiver with the specified private key, to be used for signing purposes.- Specified by:
engineInitSign
in classjava.security.SignatureSpi
- Parameters:
privateKey
- PrivateKey the key to be used when signing- Throws:
java.security.InvalidKeyException
- if the specified key is not valid (improperly encoded, parameters missing, etc)FIPSRuntimeException
- if SelfTest.isFipsRunnable returns false.
-
internalInitSign
protected void internalInitSign(java.security.PrivateKey privateKey) throws java.security.InvalidKeyException
Initialize the receiver with the specified private key, to be used for signing purposes.- Parameters:
privateKey
- PrivateKey the key to be used when signing- Throws:
java.security.InvalidKeyException
- if the specified key is not valid (improperly encoded, parameters missing, etc)
-
engineInitVerify
protected void engineInitVerify(java.security.PublicKey publicKey) throws java.security.InvalidKeyException
Initialize the receiver with the specified public key, to be used for verification purposes.- Specified by:
engineInitVerify
in classjava.security.SignatureSpi
- Parameters:
publicKey
- PublicKey the key to be used when verifying- Throws:
java.security.InvalidKeyException
- if the specified key is not valid (improperly encoded, parameters missing, etc)FIPSRuntimeException
- if SelfTest.isFipsRunnable returns false.
-
internalInitVerify
protected void internalInitVerify(java.security.PublicKey publicKey) throws java.security.InvalidKeyException
Initialize the receiver with the specified public key, to be used for verification purposes.- Parameters:
publicKey
- PublicKey the key to be used when verifying- Throws:
java.security.InvalidKeyException
- if the specified key is not valid (improperly encoded, parameters missing, etc)
-
engineSetParameter
protected void engineSetParameter(java.lang.String param, java.lang.Object value) throws java.security.InvalidParameterException
Deprecated. Replaced with engineSetParameter(AlgorithmParameterSpec)Initializes the receiver with the given parameter set.- Specified by:
engineSetParameter
in classjava.security.SignatureSpi
- Parameters:
param
- String the parameter namevalue
- Object the parameter value- Throws:
java.security.InvalidParameterException
- if the specified parameter name is not valid for the receiver or if it has been set alreadyFIPSRuntimeException
- if SelfTest.isFipsRunnable returns false.
-
internalSetParameter
protected void internalSetParameter(java.lang.String param, java.lang.Object value) throws java.security.InvalidParameterException
Deprecated. Replaced with engineSetParameter(AlgorithmParameterSpec)Initializes the receiver with the given parameter set.- Parameters:
param
- String the parameter namevalue
- Object the parameter value- Throws:
java.security.InvalidParameterException
- if the specified parameter name is not valid for the receiver or if it has been set already
-
engineSign
protected byte[] engineSign() throws java.security.SignatureException
Answers the signature bytes of the data updated so far.- Specified by:
engineSign
in classjava.security.SignatureSpi
- Returns:
- the signature bytes of the data updated so far.
- Throws:
java.security.SignatureException
- if the engine is not initialized properlyFIPSRuntimeException
- if SelfTest.isFipsRunnable returns false.
-
internalSign
protected byte[] internalSign() throws java.security.SignatureException
Answers the signature bytes of the data updated so far.- Returns:
- the signature bytes of the data updated so far.
- Throws:
java.security.SignatureException
- if the engine is not initialized properly
-
engineUpdate
protected void engineUpdate(byte b) throws java.security.SignatureException
Update the bytes signed so far with the extra byte provided.- Specified by:
engineUpdate
in classjava.security.SignatureSpi
- Parameters:
b
- byte the extra byte to be signed.- Throws:
java.security.SignatureException
- if the receiver is not initialized properly
-
internalUpdate
protected void internalUpdate(byte b) throws java.security.SignatureException
Update the bytes signed so far with the extra byte provided.- Parameters:
b
- byte the extra byte to be signed.- Throws:
java.security.SignatureException
- if the receiver is not initialized properly
-
engineUpdate
protected void engineUpdate(byte[] buffer, int offset, int length) throws java.security.SignatureException
Update the bytes signed so far with the extra bytes provided.- Specified by:
engineUpdate
in classjava.security.SignatureSpi
- Parameters:
buffer
- byte[] the extra bytes to be signed.offset
- int offset in the buffer where to start getting bytes for signinglength
- int how many bytes to get for signing- Throws:
java.security.SignatureException
- if the receiver is not initialized properlyFIPSRuntimeException
- if SelfTest.isFipsRunnable returns false.
-
internalUpdate
protected void internalUpdate(byte[] buffer, int offset, int length) throws java.security.SignatureException
Update the bytes signed so far with the extra bytes provided.- Parameters:
buffer
- byte[] the extra bytes to be signed.offset
- int offset in the buffer where to start getting bytes for signinglength
- int how many bytes to get for signing- Throws:
java.security.SignatureException
- if the receiver is not initialized properly
-
engineVerify
protected boolean engineVerify(byte[] sigBytes) throws java.security.SignatureException
Verifies the passed signature.- Specified by:
engineVerify
in classjava.security.SignatureSpi
- Parameters:
sigBytes
- byte[] the signature bytes to verify- Returns:
- true if the signature was verified successfully, false otherwise.
- Throws:
java.security.SignatureException
- if the receiver is not initialized properly or if the key is not encoded properly.FIPSRuntimeException
- if SelfTest.isFipsRunnable returns false.
-
internalVerify
protected boolean internalVerify(byte[] sigBytes) throws java.security.SignatureException
Verifies the passed signature.- Parameters:
sigBytes
- byte[] the signature bytes to verify- Returns:
- true if the signature was verified successfully, false otherwise.
- Throws:
java.security.SignatureException
- if the receiver is not initialized properly or if the key is not encoded properly.
-
toString
public java.lang.String toString()
Answers a string containing a concise, human-readable description of the receiver.- Overrides:
toString
in classjava.security.Signature
- Returns:
- a printable representation for the receiver.
- Throws:
FIPSRuntimeException
- if SelfTest.isFipsRunnable returns false.
-
internalToString
public java.lang.String internalToString()
Answers a string containing a concise, human-readable description of the receiver.- Returns:
- a printable representation for the receiver.
-
finalize
protected void finalize()
This function resets the class variables.- Overrides:
finalize
in classjava.lang.Object
-
-