Top Description Inners Fields Constructors Methods
org.bouncycastle.cms.jcajce

public Class JcaSimpleSignerInfoGeneratorBuilder

extends Object
Class Inheritance
Imports
java.security.PrivateKey, .Provider, java.security.cert.CertificateEncodingException, .X509Certificate, org.bouncycastle.asn1.cms.AttributeTable, org.bouncycastle.asn1.x509.AlgorithmIdentifier, org.bouncycastle.cert.X509CertificateHolder, org.bouncycastle.cert.jcajce.JcaX509CertificateHolder, org.bouncycastle.cms.CMSAttributeTableGenerator, .DefaultSignedAttributeTableGenerator, .SignerInfoGenerator, .SignerInfoGeneratorBuilder, org.bouncycastle.operator.ContentSigner, .DigestCalculatorProvider, .OperatorCreationException, org.bouncycastle.operator.jcajce.JcaContentSignerBuilder, .JcaDigestCalculatorProviderBuilder

Use this class if you are using a provider that has all the facilities you need.

For example:

     CMSSignedDataGenerator gen = new CMSSignedDataGenerator();
     ContentSigner sha1Signer = new JcaContentSignerBuilder("SHA1withRSA").setProvider("BC").build(signKP.getPrivate());

     gen.addSignerInfoGenerator(
               new JcaSignerInfoGeneratorBuilder(
                    new JcaDigestCalculatorProviderBuilder().setProvider("BC").build())
                    .build(sha1Signer, signCert));
becomes:
     CMSSignedDataGenerator gen = new CMSSignedDataGenerator();

     gen.addSignerInfoGenerator(
               new JcaSimpleSignerInfoGeneratorBuilder()
                    .setProvider("BC")
                    .build("SHA1withRSA", signKP.getPrivate(), signCert));

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private static class

Field Summary

Modifier and TypeField and Description
private AlgorithmIdentifier
private boolean
private JcaSimpleSignerInfoGeneratorBuilder.Helper
private CMSAttributeTableGenerator
private CMSAttributeTableGenerator

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public SignerInfoGenerator
build(String algorithmName, PrivateKey privateKey, X509CertificateHolder certificate)

public SignerInfoGenerator
build(String algorithmName, PrivateKey privateKey, X509Certificate certificate)

public SignerInfoGenerator
build(String algorithmName, PrivateKey privateKey, byte[] keyIdentifier)

private SignerInfoGeneratorBuilder
public JcaSimpleSignerInfoGeneratorBuilder
public JcaSimpleSignerInfoGeneratorBuilder

Returns:

the builder object
setDirectSignature
(boolean hasNoSignedAttributes)

If the passed in flag is true, the signer signature will be based on the data, not a collection of signed attributes, and no signed attributes will be included.

public JcaSimpleSignerInfoGeneratorBuilder
setProvider(String providerName)

public JcaSimpleSignerInfoGeneratorBuilder
public JcaSimpleSignerInfoGeneratorBuilder
public JcaSimpleSignerInfoGeneratorBuilder

Returns:

this.
setSignedAttributeGenerator
(AttributeTable
table of attributes for priming generator
attrTable
)

set up a DefaultSignedAttributeTableGenerator primed with the passed in AttributeTable.

public JcaSimpleSignerInfoGeneratorBuilder
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contentDigestback to summary
private AlgorithmIdentifier contentDigest
hasNoSignedAttributesback to summary
private boolean hasNoSignedAttributes
helperback to summary
private JcaSimpleSignerInfoGeneratorBuilder.Helper helper
signedGenback to summary
private CMSAttributeTableGenerator signedGen
unsignedGenback to summary
private CMSAttributeTableGenerator unsignedGen

Constructor Detail

JcaSimpleSignerInfoGeneratorBuilderback to summary
public JcaSimpleSignerInfoGeneratorBuilder() throws OperatorCreationException

Method Detail

buildback to summary
public SignerInfoGenerator build(String algorithmName, PrivateKey privateKey, X509CertificateHolder certificate) throws OperatorCreationException
buildback to summary
public SignerInfoGenerator build(String algorithmName, PrivateKey privateKey, X509Certificate certificate) throws OperatorCreationException, CertificateEncodingException
buildback to summary
public SignerInfoGenerator build(String algorithmName, PrivateKey privateKey, byte[] keyIdentifier) throws OperatorCreationException
configureAndBuildback to summary
private SignerInfoGeneratorBuilder configureAndBuild() throws OperatorCreationException
setContentDigestback to summary
public JcaSimpleSignerInfoGeneratorBuilder setContentDigest(AlgorithmIdentifier contentDigest)
setDirectSignatureback to summary
public JcaSimpleSignerInfoGeneratorBuilder setDirectSignature(boolean hasNoSignedAttributes)

If the passed in flag is true, the signer signature will be based on the data, not a collection of signed attributes, and no signed attributes will be included.

Returns:JcaSimpleSignerInfoGeneratorBuilder

the builder object

setProviderback to summary
public JcaSimpleSignerInfoGeneratorBuilder setProvider(String providerName) throws OperatorCreationException
setProviderback to summary
public JcaSimpleSignerInfoGeneratorBuilder setProvider(Provider provider) throws OperatorCreationException
setSignedAttributeGeneratorback to summary
public JcaSimpleSignerInfoGeneratorBuilder setSignedAttributeGenerator(CMSAttributeTableGenerator signedGen)
setSignedAttributeGeneratorback to summary
public JcaSimpleSignerInfoGeneratorBuilder setSignedAttributeGenerator(AttributeTable attrTable)

set up a DefaultSignedAttributeTableGenerator primed with the passed in AttributeTable.

Parameters
attrTable:AttributeTable

table of attributes for priming generator

Returns:JcaSimpleSignerInfoGeneratorBuilder

this.

setUnsignedAttributeGeneratorback to summary
public JcaSimpleSignerInfoGeneratorBuilder setUnsignedAttributeGenerator(CMSAttributeTableGenerator unsignedGen)
org.bouncycastle.cms.jcajce back to summary

private Class JcaSimpleSignerInfoGeneratorBuilder.Helper

extends Object
Class Inheritance
  • java.lang.Object
  • org.bouncycastle.cms.jcajce.JcaSimpleSignerInfoGeneratorBuilder.Helper
Known Direct Subclasses
org.bouncycastle.cms.jcajce.JcaSimpleSignerInfoGeneratorBuilder.NamedHelper, org.bouncycastle.cms.jcajce.JcaSimpleSignerInfoGeneratorBuilder.ProviderHelper

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv ContentSigner
createContentSigner(String algorithm, PrivateKey privateKey)

pack-priv DigestCalculatorProvider
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Helperback to summary
private Helper()

Method Detail

createContentSignerback to summary
pack-priv ContentSigner createContentSigner(String algorithm, PrivateKey privateKey) throws OperatorCreationException
createDigestCalculatorProviderback to summary
pack-priv DigestCalculatorProvider createDigestCalculatorProvider() throws OperatorCreationException
org.bouncycastle.cms.jcajce back to summary

private Class JcaSimpleSignerInfoGeneratorBuilder.NamedHelper

extends Helper
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final String

Constructor Summary

AccessConstructor and Description
public
NamedHelper(String providerName)

Method Summary

Modifier and TypeMethod and Description
pack-priv ContentSigner
pack-priv DigestCalculatorProvider

Field Detail

providerNameback to summary
private final String providerName

Constructor Detail

NamedHelperback to summary
public NamedHelper(String providerName)

Method Detail

createContentSignerback to summary
pack-priv ContentSigner createContentSigner(String algorithm, PrivateKey privateKey) throws OperatorCreationException

Overrides org.bouncycastle.cms.jcajce.JcaSimpleSignerInfoGeneratorBuilder.Helper.createContentSigner.

createDigestCalculatorProviderback to summary
pack-priv DigestCalculatorProvider createDigestCalculatorProvider() throws OperatorCreationException

Overrides org.bouncycastle.cms.jcajce.JcaSimpleSignerInfoGeneratorBuilder.Helper.createDigestCalculatorProvider.

org.bouncycastle.cms.jcajce back to summary

private Class JcaSimpleSignerInfoGeneratorBuilder.ProviderHelper

extends Helper
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final Provider

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv ContentSigner
pack-priv DigestCalculatorProvider

Field Detail

providerback to summary
private final Provider provider

Constructor Detail

ProviderHelperback to summary
public ProviderHelper(Provider provider)

Method Detail

createContentSignerback to summary
pack-priv ContentSigner createContentSigner(String algorithm, PrivateKey privateKey) throws OperatorCreationException

Overrides org.bouncycastle.cms.jcajce.JcaSimpleSignerInfoGeneratorBuilder.Helper.createContentSigner.

createDigestCalculatorProviderback to summary
pack-priv DigestCalculatorProvider createDigestCalculatorProvider() throws OperatorCreationException

Overrides org.bouncycastle.cms.jcajce.JcaSimpleSignerInfoGeneratorBuilder.Helper.createDigestCalculatorProvider.