views:

56

answers:

1

I want to prepare a digital signature over some content using PKCS#7 specifications(only Signed Data). I am getting signer certificates by accessing SMART card device. I am using BouncyCastle as a provider in Java and using getEncoded method of CMSSignedData class but the output i am getting is not right and its not working. Can anybody tell me the correct procedure or some sample code to doing the same

A: 

prepare a signedData using

crypto.signText("textTosign","ask")

'byteArr' will be ur signedData it will BASE64 encoded do decode it pass that to CMSSignedData

CMSSignedData csd = new CMSSignedData(byteArr);
CertStore cStore = csd.getCertificatesAndCRLs("Collection", "BC");
        SignerInformationStore signers = csd.getSignerInfos();
        Collection<SignerInformation> lstSigner = signers.getSigners();
Romani