के साथ अलग हस्ताक्षर सत्यापित करने के लिए जावा में BouncyCastle प्रदाता का उपयोग करके मैं एक पृथक हस्ताक्षर (सीएमएस/पीकेसी # 7 हस्ताक्षर) कैसे सत्यापित कर सकता हूं?बीसी
वर्तमान में, मेरी कोड के नीचे संदेश message-digest attribute value does not match calculated value
Security.addProvider(new BouncyCastleProvider());
File f = new File(filename);
byte[] buffer = new byte[(int)f.length()];
DataInputStream in = new DataInputStream(new FileInputStream(f));
in.readFully(buffer);
in.close();
CMSSignedData signature = new CMSSignedData(buffer);
SignerInformation signer = (SignerInformation) signature.getSignerInfos().getSigners().iterator().next();
CertStore cs = signature.getCertificatesAndCRLs("Collection", "BC");
Iterator iter = cs.getCertificates(signer.getSID()).iterator();
X509Certificate certificate = (X509Certificate) iter.next();
CMSProcessable sc = signature.getSignedContent();
signer.verify(certificate, "BC");
से पहले संदेश में एस/एमआईएम हेडर जोड़ना है। क्या आपने यहां मिले कोड का परीक्षण किया है: http: //bouncy-castle.1462172.n4.nabble.com/How-to-verify-detached-PKCS7-ignature-with-Stream-content-data-td1464668.html? वर्तमान में, कोई विशेष स्थान नहीं है जहां आप वास्तव में अलग डेटा को खाते में लेते हैं। –
मैं इस मुद्दे को आप जवाब [यहां] पा सकते हैं हल [1] [1]: http://stackoverflow.com/questions/8590426/s-mime-verification-with-x509-certificate/20649242 # 20649242 – Swapnil