Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Other Java > BOOK: Beginning Cryptography with Java
|
BOOK: Beginning Cryptography with Java
This is the forum to discuss the Wrox book Beginning Cryptography with Java by David Hook; ISBN: 9780764596339
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Cryptography with Java section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 19th, 2009, 12:13 AM
Registered User
 
Join Date: Jul 2009
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default Clarification on the signature validation

Hi all,

i am implementing the pkcs#7 signing/verifying via the Bouncy Castle API. I am following the sample method "testDetachedVerification" under the CMS package "SignedDataTest" (bcmail-jdk15-143). I realised that when we performed the signature verification, we are using the public cert of the "_signCert". This is exactly the procedure listed in the Public key cryptopgraphy.

As i am also referencing the implementation ("SignedDataExample.java" and "SignedDataProcessor.java") from the book "Beginning Cryptography with Java by David Hook", and i found out one interesting step the sample code include is the cert path validation on the public cert we used to validate the signature. Such cert path validation is not included in the "SignedDataTest" in BouncyCastle Sample.

The way i intend to implement the signature validation logic is quite similiar from the sample in "Beginning Crypto with Java" and is depicted as follow


Pre-requisite
: User insert the signer subject cert, its related CA cert into Truststore (cacerts under "jre150_05\lib\security")

1) Extract the Signer Info. As the actual signer cert may not need to exist in the signature (as per RFC3852), i will base on the signer info to locate the actual sign cert from the Truststore (cacerts under "jre150_05\lib\security").

2) construct a PKIXCertPathBuilderResult given the SignCert i located from truststore.

3) invoke signerInfo.verify(signCert, "BC")


My question is whenever we verifying the signature, do we need to perform Cert Path validation checking on the public cert we use? Based on the way i intend to impl, it seems that there will be some overhead as for each validation of signature, i need to load cert from the truststore and construct a CertPathBuilder.

Is it possible for me to omit step 2 and just do step 1) and 3) ? I will perform cert path validation on the "Pre-requisite" step, how do you guys think?

Really appreciate your input!

Regards
Yangguo
 
Old July 19th, 2009, 05:35 AM
dgh dgh is offline
Wrox Author
 
Join Date: Aug 2005
Posts: 206
Thanks: 0
Thanked 20 Times in 20 Posts
Default

With the path validation - you only need to do it if you are trying to validate a signature from the certificate stored in the message. If you already know the certificate is trusted you can skip the check if the signature validates against the certificate you trust, and the serial number/issuer indicates that it was that certificate that was used.

Regards,

David
The Following User Says Thank You to dgh For This Useful Post:
yangguo (July 19th, 2009)





Similar Threads
Thread Thread Starter Forum Replies Last Post
xsl clarification... rajesh_css XSLT 1 October 2nd, 2008 01:56 AM
Signature Validation Failure bskingle BOOK: Beginning Cryptography with Java 1 July 8th, 2008 11:52 AM
STL's clarification sspr C++ Programming 1 February 23rd, 2006 04:43 AM
clarification in xslt rameshnarayan XSLT 0 August 23rd, 2005 02:28 AM
Clarification on Namespace sathya.n XML 1 March 2nd, 2005 10:24 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.