Md5RsaSignature
insteadpublic class Md5RSASignature extends RSASignature
This class only creates a new RSASignature object and sets the
hash function to be used to MD5.
The "MD5 with RSA" signature algorithm is described in PKCS #1: RSA Encryption Version 1.5 (RFC 2313) and is recommended to be used in signing X.509/PEM certificates, certificate-revocation lists, PKCS#6 extended certificates, and other objects employing digital signatures such as X.401 message tokens. The algorithms presented in PKCS#1 are not intended to be used in PKCS#7, where signatures (encrypted message digests) are treated as octet strings, in contrast to the bit string interpretation of PKCS#1.
An application wishing to sign some message (e.g. the TBSCertificate contents of a X.509 certificate) or to verify some signature using the "MD5 with RSA" algorithm, generally has to perform three steps:
getInstance method, e.g.
Signature md5_rsa = Signature.getInstance("MD5/RSA");
md5_rsa.initSign(rsaPrivateKey);
md5_rsa.initVerify(rsaPublicKey);
sign method returning the signature as
DER encoded byte array. Otherwise, if the Signature object has been initialized for
verifying, first the data to be verified is supplied to the Signature object,
and subsequently the signature is verified by calling the verify
method, supplied with the DER encoded byte array holding the corresponding
signature:
md5_rsa.update(data); byte[] signature = md5_rsa.sign();
md5_rsa.update(data);
System.out.println("Signature " + (md5_rsa.verify(signature) ? "correct!" : "not correct!"));
RSASignature,
Md2RSASignature,
ShaRSASignature,
SslRsaSignature,
Signature,
MD5hash| Constructor and Description |
|---|
Md5RSASignature()
Deprecated.
Default Constructor.
|
engineGetParameter, engineInitSign, engineInitVerify, engineSetParameter, engineSign, engineUpdate, engineUpdate, engineVerifyclone, getAlgorithm, getInstance, getInstance, getInstance, getParameter, getParameters, getProvider, initSign, initSign, initVerify, initVerify, setParameter, setParameter, sign, sign, toString, update, update, update, update, verify, verifypublic Md5RSASignature()
Applications do not call this constructor. They shall use one of the
getInstance methods of the java.security.Signature
class for obtaining a Md5RSASignature object.
java.security.NoSuchAlgorithmException - shows that there is no implementation
of the MD5 hash algorithm.