2006/Mar/13

java.security.Signatureprovides functionality for digitally signing and verifying digital signatures. When we create an instance of the Signature class, we specify the name of the algorithm for digital signatures that will be used.

Several different algorithms, such as SHA1withRSA, SHA1withDSA, MD5withRSA, and so on are supported. The algorithm name is usually obtained by combining the name of some hashing algorithm with the name of some encrypting algorithm.

When signing messages, we use the initSign() methods that take the private key, update() that takes the message for signing, and sign() that signs the message and returns the calculated signature.

When we verify digital signatures, we use the initVerify() methods that take the public key for the verification, update() that takes the signed message, and verify() that takes the signature for verification and returns if the signature verification is successful (if the signature corresponds to the given message and public key).


Example.


InputStream inStream = new FileInputStream("D:/Workspace/IS/ExportSW/conf/tomcat.cert");
CertificateFactory cf = CertificateFactory.getInstance("X.509");
X509Certificate cert = (X509Certificate)cf.generateCertificate(inStream);
inStream.close();
ชื่อ: 
เว็บไซต์: 
คอมเมนต์:




smilebig smileopen-mounthed smileconfused smilesad smileangry smiletonguequestionembarrassedsurprised smilewinkdouble winkcry
fdsafsafsafsa
#1  by  asd (147.228.108.98) At 2006-04-25 20:56, 
#2  by   (200.6.237.25) At 2007-09-26 02:06, 
mmm
#3  by   (123.14.24.187) At 2009-12-08 20:45, 

<< Home