Top Description Fields Constructors Methods
org.bouncycastle.operator.jcajce

public Class JcaContentSignerBuilder

extends Object
Class Inheritance
Imports
java.io.IOException, .OutputStream, java.security.GeneralSecurityException, .PrivateKey, .Provider, .PublicKey, .SecureRandom, .Signature, .SignatureException, java.security.spec.AlgorithmParameterSpec, .MGF1ParameterSpec, .PSSParameterSpec, java.util.HashSet, .List, .Set, org.bouncycastle.asn1.ASN1EncodableVector, .ASN1Encoding, .ASN1Integer, .ASN1Sequence, .DERBitString, .DERNull, .DERSequence, org.bouncycastle.asn1.misc.MiscObjectIdentifiers, org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers, .PrivateKeyInfo, .RSASSAPSSparams, org.bouncycastle.asn1.x509.AlgorithmIdentifier, .SubjectPublicKeyInfo, org.bouncycastle.jcajce.CompositePrivateKey, org.bouncycastle.jcajce.io.OutputStreamFactory, org.bouncycastle.jcajce.spec.CompositeAlgorithmSpec, org.bouncycastle.jcajce.util.DefaultJcaJceHelper, .NamedJcaJceHelper, .ProviderJcaJceHelper, org.bouncycastle.operator.ContentSigner, .DefaultDigestAlgorithmIdentifierFinder, .DefaultSignatureAlgorithmIdentifierFinder, .DigestAlgorithmIdentifierFinder, .ExtendedContentSigner, .OperatorCreationException, .RuntimeOperatorException, .SignatureAlgorithmIdentifierFinder, org.bouncycastle.pqc.crypto.lms.LMSigParameters, org.bouncycastle.util.Pack, .Strings, org.bouncycastle.util.io.TeeOutputStream

General builder class for ContentSigner operators based on the JCA.

Field Summary

Modifier and TypeField and Description
private OperatorHelper
private static final Set<E>
private SecureRandom
private AlgorithmIdentifier
private AlgorithmParameterSpec
private static final DefaultSignatureAlgorithmIdentifierFinder
private final String
private final AlgorithmIdentifier

Constructor Summary

AccessConstructor and Description
public
JcaContentSignerBuilder(String
the signature algorithm we perform.
signatureAlgorithm
)

Construct a basic content signer where the signature algorithm name tells us all we need to know.

public
JcaContentSignerBuilder(String
the signature algorithm we perform.
signatureAlgorithm
,
PublicKey
the public key associated with our private key.
verificationKey
)

Constructor which calculates the digest algorithm used from the public key, if necessary.

public
JcaContentSignerBuilder(String
the signature algorithm we perform.
signatureAlgorithm
,
AlgorithmIdentifier
the public key associated with our private key.
signatureDigestAlgorithmID
)

Constructor which includes the digest algorithm identifier used.

public
JcaContentSignerBuilder(String signatureAlgorithm, AlgorithmParameterSpec sigParamSpec)

public
JcaContentSignerBuilder(String signatureAlgorithm, AlgorithmParameterSpec sigParamSpec, AlgorithmIdentifier signatureDigestAlgorithmID)

Method Summary

Modifier and TypeMethod and Description
public ContentSigner
build(PrivateKey privateKey)

private ContentSigner
private static ASN1Sequence
private static RSASSAPSSparams
private AlgorithmIdentifier
getSigAlgId(PrivateKey privateKey)

private static AlgorithmIdentifier
public JcaContentSignerBuilder
public JcaContentSignerBuilder
setProvider(String providerName)

public JcaContentSignerBuilder
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

helperback to summary
private OperatorHelper helper
isAlgIdFromPrivateback to summary
private static final Set<E> isAlgIdFromPrivate
randomback to summary
private SecureRandom random
sigAlgIdback to summary
private AlgorithmIdentifier sigAlgId
sigAlgSpecback to summary
private AlgorithmParameterSpec sigAlgSpec
SIGNATURE_ALGORITHM_IDENTIFIER_FINDERback to summary
private static final DefaultSignatureAlgorithmIdentifierFinder SIGNATURE_ALGORITHM_IDENTIFIER_FINDER
signatureAlgorithmback to summary
private final String signatureAlgorithm
signatureDigestAlgorithmback to summary
private final AlgorithmIdentifier signatureDigestAlgorithm

Constructor Detail

JcaContentSignerBuilderback to summary
public JcaContentSignerBuilder(String signatureAlgorithm)

Construct a basic content signer where the signature algorithm name tells us all we need to know.

Parameters
signatureAlgorithm:String

the signature algorithm we perform.

JcaContentSignerBuilderback to summary
public JcaContentSignerBuilder(String signatureAlgorithm, PublicKey verificationKey)

Constructor which calculates the digest algorithm used from the public key, if necessary.

Some PKIX operations, such as CMS signing, require the digest algorithm used for in the signature. Some algorithms, such as LMS, use different digests with different parameter sets but the same OID is used to represent the signature. In this case we either need to be told what digest is associated with the parameter set, or we need the public key so we can work it out.

Parameters
signatureAlgorithm:String

the signature algorithm we perform.

verificationKey:PublicKey

the public key associated with our private key.

JcaContentSignerBuilderback to summary
public JcaContentSignerBuilder(String signatureAlgorithm, AlgorithmIdentifier signatureDigestAlgorithmID)

Constructor which includes the digest algorithm identifier used.

Some PKIX operations, such as CMS signing, require the digest algorithm used for in the signature, this constructor allows the digest algorithm identifier to be explicitly specified.

Parameters
signatureAlgorithm:String

the signature algorithm we perform.

signatureDigestAlgorithmID:AlgorithmIdentifier

the public key associated with our private key.

JcaContentSignerBuilderback to summary
public JcaContentSignerBuilder(String signatureAlgorithm, AlgorithmParameterSpec sigParamSpec)
JcaContentSignerBuilderback to summary
public JcaContentSignerBuilder(String signatureAlgorithm, AlgorithmParameterSpec sigParamSpec, AlgorithmIdentifier signatureDigestAlgorithmID)

Method Detail

buildback to summary
public ContentSigner build(PrivateKey privateKey) throws OperatorCreationException
buildCompositeback to summary
private ContentSigner buildComposite(CompositePrivateKey privateKey) throws OperatorCreationException
createCompParamsback to summary
private static ASN1Sequence createCompParams(CompositeAlgorithmSpec compSpec)
createPSSParamsback to summary
private static RSASSAPSSparams createPSSParams(PSSParameterSpec pssSpec)
getSigAlgIdback to summary
private AlgorithmIdentifier getSigAlgId(PrivateKey privateKey)
getSigDigAlgIdback to summary
private static AlgorithmIdentifier getSigDigAlgId(PublicKey publicKey)
setProviderback to summary
public JcaContentSignerBuilder setProvider(Provider provider)
setProviderback to summary
public JcaContentSignerBuilder setProvider(String providerName)
setSecureRandomback to summary
public JcaContentSignerBuilder setSecureRandom(SecureRandom random)