|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--java.security.SignatureSpi
|
+--de.flexiprovider.api.Signature
|
+--de.flexiprovider.core.rsa.RSASignaturePKCS1v15
The deterministic RSA signature algorithm RSASSA-PKCS1-v1_5, originally defined in PKCS #1 v1.5, implemented as per PKCS#1 version 2.1 with a variable message digest algorithm. EMSA-PKCS1-v1_5 (defined in the IEEE P1363a draft) is used for message encoding, which embeds a hash identifier in the signature. Whilst no attack against RSASSA-PKCS1-v1_5 is currently known, it is suggested to move to RSASSA-PSS as a security precaution (stronger theoretical security properties apply to RSASSA-PSS in the random oracle model).
Subclassing it and overriding the getOID and getMessageDigest methods yields the message digest specific classes.
| Inner Class Summary | |
static class |
RSASignaturePKCS1v15.MD5
RSA PKCS#1 v1.5 signature with MD5 message digest |
static class |
RSASignaturePKCS1v15.RawMD5
RSA PKCS#1 v1.5 signature with MD5 message digest |
static class |
RSASignaturePKCS1v15.RawRIPEMD160
RSA PKCS#1 v1.5 signature with RIPEMD-160 message digest |
static class |
RSASignaturePKCS1v15.RawSHA1
RSA PKCS#1 v1.5 signature with SHA-1 message digest |
static class |
RSASignaturePKCS1v15.RawSHA224
RSA PKCS#1 v1.5 signature with SHA-224 message digest |
static class |
RSASignaturePKCS1v15.RawSHA256
RSA PKCS#1 v1.5 signature with SHA-256 message digest |
static class |
RSASignaturePKCS1v15.RawSHA384
RSA PKCS#1 v1.5 signature with SHA-384 message digest |
static class |
RSASignaturePKCS1v15.RawSHA512
RSA PKCS#1 v1.5 signature with SHA-512 message digest |
static class |
RSASignaturePKCS1v15.RIPEMD160
RSA PKCS#1 v1.5 signature with RIPEMD-160 message digest |
static class |
RSASignaturePKCS1v15.SHA1
RSA PKCS#1 v1.5 signature with SHA-1 message digest |
static class |
RSASignaturePKCS1v15.SHA224
RSA PKCS#1 v1.5 signature with SHA-224 message digest |
static class |
RSASignaturePKCS1v15.SHA256
RSA PKCS#1 v1.5 signature with SHA-256 message digest |
static class |
RSASignaturePKCS1v15.SHA384
RSA PKCS#1 v1.5 signature with SHA-384 message digest |
static class |
RSASignaturePKCS1v15.SHA512
RSA PKCS#1 v1.5 signature with SHA-512 message digest |
| Fields inherited from class java.security.SignatureSpi |
appRandom |
| Constructor Summary | |
protected |
RSASignaturePKCS1v15(java.lang.String oidStr,
MessageDigest md)
Constructor. |
| Method Summary | |
void |
initSign(PrivateKey privateKey,
SecureRandom secureRandom)
Initializes the signature algorithm for signing a message. |
void |
initVerify(PublicKey publicKey)
Initializes the signature algorithm for verifying a signature. |
void |
setParameters(AlgorithmParameterSpec params)
Set parameters for the signature (not used). |
byte[] |
sign()
Signs a message. |
void |
update(byte b)
Feeds a message byte to the message digest. |
void |
update(byte[] b,
int offset,
int length)
Feeds message bytes to the message digest. |
boolean |
verify(byte[] signature)
Verifies a signature. |
| Methods inherited from class de.flexiprovider.api.Signature |
engineGetParameter, engineInitSign, engineInitSign, engineInitVerify, engineSetParameter, engineSetParameter, engineSign, engineUpdate, engineUpdate, engineVerify, engineVerify, initSign, sign, update, verify, verify, verify |
| Methods inherited from class java.security.SignatureSpi |
clone, engineSign |
| Methods inherited from class java.lang.Object |
|
| Constructor Detail |
protected RSASignaturePKCS1v15(java.lang.String oidStr,
MessageDigest md)
oidStr - the OIDmd - the message digest| Method Detail |
public void initSign(PrivateKey privateKey,
SecureRandom secureRandom)
throws InvalidKeyException
initSign in class SignatureprivateKey - the private key of the signer.secureRandom - the source of randomness.InvalidKeyException - if the key is not an instance of RSAPrivKey.
public void initVerify(PublicKey publicKey)
throws InvalidKeyException
initVerify in class SignaturepublicKey - the public key of the signer.InvalidKeyException - if the public key is not an instance of RSAPubKey.public void setParameters(AlgorithmParameterSpec params)
setParameters in class Signatureparams - the parameters (not used)
public void update(byte[] b,
int offset,
int length)
update in class Signatureb - array of message bytesoffset - index of message startlength - number of message bytespublic void update(byte b)
update in class Signatureb - array of message bytes
public byte[] sign()
throws SignatureException
sign in class SignatureSignatureException - if the signature is not initialized properly.public boolean verify(byte[] signature)
verify in class Signaturesignature - the signature to be verified
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||