kz.gamma.hardware.cms
Class CMSSignedDataGenerator

java.lang.Object
  extended by kz.gamma.hardware.cms.CMSSignedGenerator
      extended by kz.gamma.hardware.cms.CMSSignedDataGenerator

public class CMSSignedDataGenerator
extends CMSSignedGenerator

general class for generating a pkcs7-signature message.

A simple example of usage.

      CertStore               certs...
      CMSSignedDataGenerator    gen = new CMSSignedDataGenerator();
 

gen.addSigner(privKey, cert, CMSSignedGenerator.DIGEST_SHA1); gen.addCertificatesAndCRLs(certs);

CMSSignedData data = gen.generate(content, GammaTechProvider.PROVIDER_NAME);


Nested Class Summary
(package private) static class CMSSignedDataGenerator.DigOutputStream
           
private  class CMSSignedDataGenerator.SignerInf
           
(package private) static class CMSSignedDataGenerator.SigOutputStream
           
 
Field Summary
(package private)  boolean isCertexCMS
           
(package private)  java.util.List signerInfs
           
 
Fields inherited from class kz.gamma.hardware.cms.CMSSignedGenerator
_certs, _crls, _digests, _signers, DATA, DIGEST_GOST3411G, DIGEST_KZ_GOST_34_11_95, DIGEST_MD5, DIGEST_SHA1, ENCRYPTION_ECGOST3410, ENCRYPTION_KZ_GOST_34_310_SIGNATURE, ENCRYPTION_RSA
 
Constructor Summary
CMSSignedDataGenerator()
          base constructor
 
Method Summary
 void addSigner(JCEPrivateKey key, java.security.cert.X509Certificate cert, java.lang.String digestOID)
          add a signer - no attributes other than the default ones will be provided here.
 void addSigner(JCEPrivateKey key, java.security.cert.X509Certificate cert, java.lang.String digestOID, AttributeTable signedAttr, AttributeTable unsignedAttr)
          add a signer with extra signed/unsigned attributes.
 void addSigner(JCEPrivateKey key, java.security.cert.X509Certificate cert, java.lang.String digestOID, CMSAttributeTableGenerator signedAttrGen, CMSAttributeTableGenerator unsignedAttrGen)
          add a signer with extra signed/unsigned attributes based on generators.
 CMSSignedData generate(CMSProcessable content, boolean encapsulate, JCESignature signature)
          generate a signed object that for a CMS Signed Data object using the given provider - if encapsulate is true a copy of the message will be included in the signature with the default content type "data".
 CMSSignedData generate(CMSProcessable content, JCESignature signature)
          generate a signed object that for a CMS Signed Data object using the given provider.
 CMSSignedData generate(java.lang.String signedContentType, CMSProcessable content, boolean encapsulate, JCESignature signature)
          generate a signed object that for a CMS Signed Data object using the given provider - if encapsulate is true a copy of the message will be included in the signature.
 CMSSignedData generate(java.lang.String signedContentType, CMSProcessable content, boolean encapsulate, JCESignature signature, boolean addDefaultAttributes)
          Similar method to the other generate methods.
private  AlgorithmIdentifier makeAlgId(java.lang.String oid, byte[] params)
           
private  DERObject makeObj(byte[] encoding)
           
 
Methods inherited from class kz.gamma.hardware.cms.CMSSignedGenerator
addAttributeCertificates, addCertificatesAndCRLs, addSigners, getAttributeSet, getBaseParameters, getEncAlgorithmIdentifier, getEncOID, getGeneratedDigests
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

signerInfs

java.util.List signerInfs

isCertexCMS

boolean isCertexCMS
Constructor Detail

CMSSignedDataGenerator

public CMSSignedDataGenerator()
base constructor

Method Detail

addSigner

public void addSigner(JCEPrivateKey key,
                      java.security.cert.X509Certificate cert,
                      java.lang.String digestOID)
               throws java.lang.IllegalArgumentException
add a signer - no attributes other than the default ones will be provided here.

Throws:
java.lang.IllegalArgumentException

addSigner

public void addSigner(JCEPrivateKey key,
                      java.security.cert.X509Certificate cert,
                      java.lang.String digestOID,
                      AttributeTable signedAttr,
                      AttributeTable unsignedAttr)
               throws java.lang.IllegalArgumentException
add a signer with extra signed/unsigned attributes.

Throws:
java.lang.IllegalArgumentException

addSigner

public void addSigner(JCEPrivateKey key,
                      java.security.cert.X509Certificate cert,
                      java.lang.String digestOID,
                      CMSAttributeTableGenerator signedAttrGen,
                      CMSAttributeTableGenerator unsignedAttrGen)
               throws java.lang.IllegalArgumentException
add a signer with extra signed/unsigned attributes based on generators.

Throws:
java.lang.IllegalArgumentException

makeObj

private DERObject makeObj(byte[] encoding)
                   throws java.io.IOException
Throws:
java.io.IOException

makeAlgId

private AlgorithmIdentifier makeAlgId(java.lang.String oid,
                                      byte[] params)
                               throws java.io.IOException
Throws:
java.io.IOException

generate

public CMSSignedData generate(CMSProcessable content,
                              JCESignature signature)
                       throws CMSException
generate a signed object that for a CMS Signed Data object using the given provider.

Throws:
CMSException

generate

public CMSSignedData generate(java.lang.String signedContentType,
                              CMSProcessable content,
                              boolean encapsulate,
                              JCESignature signature)
                       throws CMSException
generate a signed object that for a CMS Signed Data object using the given provider - if encapsulate is true a copy of the message will be included in the signature. The content type is set according to the OID represented by the string signedContentType.

Throws:
CMSException

generate

public CMSSignedData generate(java.lang.String signedContentType,
                              CMSProcessable content,
                              boolean encapsulate,
                              JCESignature signature,
                              boolean addDefaultAttributes)
                       throws CMSException
Similar method to the other generate methods. The additional argument addDefaultAttributes indicates whether or not a default set of signed attributes need to be added automatically. If the argument is set to false, no attributes will get added at all.

Throws:
CMSException

generate

public CMSSignedData generate(CMSProcessable content,
                              boolean encapsulate,
                              JCESignature signature)
                       throws CMSException
generate a signed object that for a CMS Signed Data object using the given provider - if encapsulate is true a copy of the message will be included in the signature with the default content type "data".

Throws:
CMSException


Copyright © 2013 Gamma Technologies. All Rights Reserved.