Package org.bouncycastle.cms.jcajce
Class JcaSimpleSignerInfoGeneratorBuilder
- java.lang.Object
-
- org.bouncycastle.cms.jcajce.JcaSimpleSignerInfoGeneratorBuilder
-
public class JcaSimpleSignerInfoGeneratorBuilder extends java.lang.Object
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));
-
-
Constructor Summary
Constructors Constructor Description JcaSimpleSignerInfoGeneratorBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SignerInfoGenerator
build(java.lang.String algorithmName, java.security.PrivateKey privateKey, byte[] keyIdentifier)
SignerInfoGenerator
build(java.lang.String algorithmName, java.security.PrivateKey privateKey, java.security.cert.X509Certificate certificate)
SignerInfoGenerator
build(java.lang.String algorithmName, java.security.PrivateKey privateKey, X509CertificateHolder certificate)
JcaSimpleSignerInfoGeneratorBuilder
setContentDigest(org.bouncycastle.asn1.x509.AlgorithmIdentifier contentDigest)
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.JcaSimpleSignerInfoGeneratorBuilder
setProvider(java.lang.String providerName)
JcaSimpleSignerInfoGeneratorBuilder
setProvider(java.security.Provider provider)
JcaSimpleSignerInfoGeneratorBuilder
setSignedAttributeGenerator(org.bouncycastle.asn1.cms.AttributeTable attrTable)
set up a DefaultSignedAttributeTableGenerator primed with the passed in AttributeTable.JcaSimpleSignerInfoGeneratorBuilder
setSignedAttributeGenerator(CMSAttributeTableGenerator signedGen)
JcaSimpleSignerInfoGeneratorBuilder
setUnsignedAttributeGenerator(CMSAttributeTableGenerator unsignedGen)
-
-
-
Method Detail
-
setProvider
public JcaSimpleSignerInfoGeneratorBuilder setProvider(java.lang.String providerName) throws org.bouncycastle.operator.OperatorCreationException
- Throws:
org.bouncycastle.operator.OperatorCreationException
-
setProvider
public JcaSimpleSignerInfoGeneratorBuilder setProvider(java.security.Provider provider) throws org.bouncycastle.operator.OperatorCreationException
- Throws:
org.bouncycastle.operator.OperatorCreationException
-
setDirectSignature
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:
- the builder object
-
setContentDigest
public JcaSimpleSignerInfoGeneratorBuilder setContentDigest(org.bouncycastle.asn1.x509.AlgorithmIdentifier contentDigest)
-
setSignedAttributeGenerator
public JcaSimpleSignerInfoGeneratorBuilder setSignedAttributeGenerator(CMSAttributeTableGenerator signedGen)
-
setSignedAttributeGenerator
public JcaSimpleSignerInfoGeneratorBuilder setSignedAttributeGenerator(org.bouncycastle.asn1.cms.AttributeTable attrTable)
set up a DefaultSignedAttributeTableGenerator primed with the passed in AttributeTable.- Parameters:
attrTable
- table of attributes for priming generator- Returns:
- this.
-
setUnsignedAttributeGenerator
public JcaSimpleSignerInfoGeneratorBuilder setUnsignedAttributeGenerator(CMSAttributeTableGenerator unsignedGen)
-
build
public SignerInfoGenerator build(java.lang.String algorithmName, java.security.PrivateKey privateKey, X509CertificateHolder certificate) throws org.bouncycastle.operator.OperatorCreationException
- Throws:
org.bouncycastle.operator.OperatorCreationException
-
build
public SignerInfoGenerator build(java.lang.String algorithmName, java.security.PrivateKey privateKey, java.security.cert.X509Certificate certificate) throws org.bouncycastle.operator.OperatorCreationException, java.security.cert.CertificateEncodingException
- Throws:
org.bouncycastle.operator.OperatorCreationException
java.security.cert.CertificateEncodingException
-
build
public SignerInfoGenerator build(java.lang.String algorithmName, java.security.PrivateKey privateKey, byte[] keyIdentifier) throws org.bouncycastle.operator.OperatorCreationException
- Throws:
org.bouncycastle.operator.OperatorCreationException
-
-