[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bouncycastle-crypto-dev
Subject:    Re: [dev-crypto] Signature Generation using PKCS7 Specs
From:       Thomas Chojecki <info () rayman2200 ! de>
Date:       2010-07-13 9:50:46
Message-ID: 4C3C36F6.9090003 () rayman2200 ! de
[Download RAW message or body]

Am 13.07.2010 11:31, schrieb abhishek.singh:
>
> I have to generate a digital signature using PKCS7 specifications with
> following data structures

For PKCS7 Signature you can use

CMSSignedDataGenerator gen = new CMSSignedDataGenerator();

> Content Info{
> 	Content Type : "Some Value"
> 	Content : "Some Value"
> }
>
> SignedData{
> 	Version : "Some Value"
> 	DigestAlgorithms : "Some Value"
> 	ContentInfo : "Some Value"
> 	Set of Certificates : "Some Value"
> 	Set of CRLs : "Some Value"
> 	Stack of Signer Info : "Some Value"
>
> }
>
> Signer Info {
> 	Version : "Some Value"
> 	IssuerAndSerialNumber : "Some Value"
> 	algorithm ID :  "Some Value"
> 	AuthenticatedAttributes : "Some Value"
> 	digestEncryptionAlgorithm : "Some Value"
> 	EncryptedDigest : "Some Value"
> 	unauthenticatedAttributes : "Some Value"
> }

for the SignedData and SignerInfo you can use something like that

Hashtable signedDataHashTable = new Hashtable();
Attribute someAttribute = new Attribute(DERObjectIdentifier, DERSet);
signedDataHashTable.put(someAttribute.getAttrType(), someAttribute);

Hashtable unsignedDataHashTable = new Hashtable();

AttributeTable signedData = new AttributeTable(signedDataHashTable);
AttributeTable unsignedData = new AttributeTable(unsignedDataHashTable);

gen.addSigner(privKey,x509certificate, signatureAlgorithm, signedData, 
unsignedData);



For generating the signature use one of this generate methodes

gen.generate(....);

> Can Anyone tell me that what will be the procedure or some sample code to
> generate the signature using BouncyCastle API ?

hope someone else can help you with the other parameters

Regards
Thomas

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic