com.ibm.crypto.fips.provider
Class DatawithRSA
- java.lang.Object
-
- java.security.SignatureSpi
-
- java.security.Signature
-
- com.ibm.crypto.fips.provider.DatawithRSA
-
public final class DatawithRSA extends java.security.Signature
This class implements signature without this algorithm doing the hashing with RSA
-
-
Constructor Summary
Constructors Constructor and Description DatawithRSA()
Construct a blank RSA object.
-
Method Summary
Methods Modifier and Type Method and Description protected java.lang.Object
engineGetParameter(java.lang.String key)
Have to implement Signature's abstract method engineGetParameter to be a concrete class.protected void
engineInitSign(java.security.PrivateKey privateKey)
Initialize the RSA object with a RSA private key.protected void
engineInitVerify(java.security.PublicKey publicKey)
Initialize the RSA object with a RSA public key.protected void
engineSetParameter(java.lang.String key, java.lang.Object param)
Have to implement Signature's abstract method engineSetParameter to be a concrete class.protected byte[]
engineSign()
Get message digest for all the data thus far updated, then sign the message digest.protected void
engineUpdate(byte b)
Update a byte to be signed or verified.protected void
engineUpdate(byte[] dataBuf, int off, int len)
Update an array of bytes to be signed or verified.protected boolean
engineVerify(byte[] signature)
Verify the signature (compare the result with the message digest).protected void
finalize()
This function resets the class variables.protected java.lang.Object
internalGetParameter(java.lang.String key)
Have to implement Signature's abstract method engineGetParameter to be a concrete class.protected void
internalInitSign(java.security.PrivateKey privateKey)
Initialize the RSA object with a RSA private key.protected void
internalInitVerify(java.security.PublicKey publicKey)
Initialize the RSA object with a RSA public key.protected void
internalSetParameter(java.lang.String key, java.lang.Object param)
Have to implement Signature's abstract method engineSetParameter to be a concrete class.protected byte[]
internalSign()
Get message digest for all the data thus far updated, then sign the message digest.protected void
internalUpdate(byte b)
Update a byte to be signed or verified.protected boolean
internalVerify(byte[] signature)
Verify the signature (compare the result with the message digest).-
Methods inherited from class java.security.Signature
clone, getAlgorithm, getInstance, getInstance, getInstance, getParameter, getParameters, getProvider, initSign, initSign, initVerify, initVerify, setParameter, setParameter, sign, sign, toString, update, update, update, update, verify, verify
-
-
-
-
Constructor Detail
-
DatawithRSA
public DatawithRSA()
Construct a blank RSA object. It must be initialized before being usable for signing or verifying.
-
-
Method Detail
-
engineSetParameter
protected void engineSetParameter(java.lang.String key, java.lang.Object param)
Have to implement Signature's abstract method engineSetParameter to be a concrete class.- Specified by:
engineSetParameter
in classjava.security.SignatureSpi
- Throws:
FIPSRuntimeException
- if SelfTest.isFipsRunnable returns false.
-
internalSetParameter
protected void internalSetParameter(java.lang.String key, java.lang.Object param)
Have to implement Signature's abstract method engineSetParameter to be a concrete class.
-
engineGetParameter
protected java.lang.Object engineGetParameter(java.lang.String key)
Have to implement Signature's abstract method engineGetParameter to be a concrete class.- Specified by:
engineGetParameter
in classjava.security.SignatureSpi
- Throws:
FIPSRuntimeException
- if SelfTest.isFipsRunnable returns false.
-
internalGetParameter
protected java.lang.Object internalGetParameter(java.lang.String key)
Have to implement Signature's abstract method engineGetParameter to be a concrete class.
-
engineInitSign
protected void engineInitSign(java.security.PrivateKey privateKey) throws java.security.InvalidKeyException
Initialize the RSA object with a RSA private key.- Specified by:
engineInitSign
in classjava.security.SignatureSpi
- Parameters:
privateKey
- the RSA private key- Throws:
java.security.InvalidKeyException
- if the key is not a valid RSA private key.FIPSRuntimeException
- if SelfTest.isFipsRunnable returns false.
-
internalInitSign
protected void internalInitSign(java.security.PrivateKey privateKey) throws java.security.InvalidKeyException
Initialize the RSA object with a RSA private key.- Parameters:
privateKey
- the RSA private key- Throws:
java.security.InvalidKeyException
- if the key is not a valid RSA private key.
-
engineInitVerify
protected void engineInitVerify(java.security.PublicKey publicKey) throws java.security.InvalidKeyException
Initialize the RSA object with a RSA public key.- Specified by:
engineInitVerify
in classjava.security.SignatureSpi
- Parameters:
publicKey
- the RSA public key- Throws:
java.security.InvalidKeyException
- if the key is not a valid RSA public key.FIPSRuntimeException
- if SelfTest.isFipsRunnable returns false.
-
internalInitVerify
protected void internalInitVerify(java.security.PublicKey publicKey) throws java.security.InvalidKeyException
Initialize the RSA object with a RSA public key.- Parameters:
publicKey
- the RSA public key- Throws:
java.security.InvalidKeyException
- if the key is not a valid RSA public key.
-
engineUpdate
protected void engineUpdate(byte b)
Update a byte to be signed or verified.- Specified by:
engineUpdate
in classjava.security.SignatureSpi
- Parameters:
b
- the byte to updated.- Throws:
FIPSRuntimeException
- if SelfTest.isFipsRunnable returns false.
-
internalUpdate
protected void internalUpdate(byte b)
Update a byte to be signed or verified.- Parameters:
b
- the byte to updated.
-
engineUpdate
protected void engineUpdate(byte[] dataBuf, int off, int len)
Update an array of bytes to be signed or verified.- Specified by:
engineUpdate
in classjava.security.SignatureSpi
- Parameters:
data
- the bytes to be updated.
-
engineSign
protected byte[] engineSign() throws java.security.SignatureException
Get message digest for all the data thus far updated, then sign the message digest.- Specified by:
engineSign
in classjava.security.SignatureSpi
- Returns:
- the signature.
- Throws:
FIPSRuntimeException
- if SelfTest.isFipsRunnable returns false.java.security.SignatureException
- if the signature object was not properly initialized, or if another exception occurs.
-
internalSign
protected byte[] internalSign() throws java.security.SignatureException
Get message digest for all the data thus far updated, then sign the message digest.- Returns:
- the signature.
- Throws:
java.security.SignatureException
- if the signature object was not properly initialized, or if another exception occurs.
-
engineVerify
protected boolean engineVerify(byte[] signature) throws java.security.SignatureException
Verify the signature (compare the result with the message digest).- Specified by:
engineVerify
in classjava.security.SignatureSpi
- Throws:
java.security.SignatureException
- if the signature object was not properly initialized, or if another exception occurs.FIPSRuntimeException
- if SelfTest.isFipsRunnable returns false.
-
internalVerify
protected boolean internalVerify(byte[] signature) throws java.security.SignatureException
Verify the signature (compare the result with the message digest).- Throws:
java.security.SignatureException
- if the signature object was not properly initialized, or if another exception occurs.
-
finalize
protected void finalize()
This function resets the class variables.- Overrides:
finalize
in classjava.lang.Object
-
-