|
Bouncy Castle Cryptography Library 1.79 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.bouncycastle.cms.CMSSignedGenerator | +--org.bouncycastle.cms.CMSSignedDataStreamGenerator
General class for generating a pkcs7-signature message stream.
A simple example of usage.
X509Certificate signCert = [] certList.add(signCert); Store certs = new JcaCertStore(certList); ContentSigner sha1Signer = new JcaContentSignerBuilder("SHA1withRSA").setProvider("BC").build(signKP.getPrivate()); CMSSignedDataStreamGenerator gen = new CMSSignedDataStreamGenerator(); gen.addSignerInfoGenerator( new JcaSignerInfoGeneratorBuilder( new JcaDigestCalculatorProviderBuilder().setProvider("BC").build()) .build(sha1Signer, signCert)); gen.addCertificates(certs); OutputStream sigOut = gen.open(bOut); sigOut.write("Hello World!".getBytes()); sigOut.close();
Fields inherited from class org.bouncycastle.cms.CMSSignedGenerator |
_signers, certs, crls, DATA, DIGEST_GOST3411, DIGEST_MD5, DIGEST_RIPEMD128, DIGEST_RIPEMD160, DIGEST_RIPEMD256, DIGEST_SHA1, DIGEST_SHA224, DIGEST_SHA256, DIGEST_SHA384, DIGEST_SHA512, digestAlgIdFinder, digests, ENCRYPTION_DSA, ENCRYPTION_ECDSA, ENCRYPTION_ECGOST3410, ENCRYPTION_ECGOST3410_2012_256, ENCRYPTION_ECGOST3410_2012_512, ENCRYPTION_GOST3410, ENCRYPTION_RSA, ENCRYPTION_RSA_PSS, signerGens |
Constructor Summary | |
CMSSignedDataStreamGenerator()
base constructor |
|
CMSSignedDataStreamGenerator(DigestAlgorithmIdentifierFinder digestAlgIdFinder)
base constructor with a custom DigestAlgorithmIdentifierFinder |
Method Summary | |
java.util.List |
getDigestAlgorithms()
Return a list of the current Digest AlgorithmIdentifiers applying to the next signature. |
java.io.OutputStream |
open(org.bouncycastle.asn1.ASN1ObjectIdentifier eContentType,
java.io.OutputStream out,
boolean encapsulate)
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. |
java.io.OutputStream |
open(org.bouncycastle.asn1.ASN1ObjectIdentifier eContentType,
java.io.OutputStream out,
boolean encapsulate,
java.io.OutputStream dataOutputStream)
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. |
java.io.OutputStream |
open(java.io.OutputStream out)
generate a signed object that for a CMS Signed Data object using the given provider. |
java.io.OutputStream |
open(java.io.OutputStream out,
boolean encapsulate)
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". |
java.io.OutputStream |
open(java.io.OutputStream out,
boolean encapsulate,
java.io.OutputStream dataOutputStream)
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". |
void |
setBufferSize(int bufferSize)
Set the underlying string size for encapsulated data |
Methods inherited from class org.bouncycastle.cms.CMSSignedGenerator |
addAttributeCertificate, addAttributeCertificates, addCertificate, addCertificates, addCRL, addCRLs, addOtherRevocationInfo, addOtherRevocationInfo, addSignerInfoGenerator, addSigners, getBaseParameters, getGeneratedDigests |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CMSSignedDataStreamGenerator()
public CMSSignedDataStreamGenerator(DigestAlgorithmIdentifierFinder digestAlgIdFinder)
Method Detail |
public void setBufferSize(int bufferSize)
bufferSize
- length of octet strings to buffer the data.public java.io.OutputStream open(java.io.OutputStream out) throws java.io.IOException
public java.io.OutputStream open(java.io.OutputStream out, boolean encapsulate) throws java.io.IOException
public java.io.OutputStream open(java.io.OutputStream out, boolean encapsulate, java.io.OutputStream dataOutputStream) throws java.io.IOException
out
- stream the CMS object is to be written to.encapsulate
- true if data should be encapsulated.dataOutputStream
- output stream to copy the data being signed to.public java.io.OutputStream open(org.bouncycastle.asn1.ASN1ObjectIdentifier eContentType, java.io.OutputStream out, boolean encapsulate) throws java.io.IOException
public java.io.OutputStream open(org.bouncycastle.asn1.ASN1ObjectIdentifier eContentType, java.io.OutputStream out, boolean encapsulate, java.io.OutputStream dataOutputStream) throws java.io.IOException
eContentType
- OID for data to be signed.out
- stream the CMS object is to be written to.encapsulate
- true if data should be encapsulated.dataOutputStream
- output stream to copy the data being signed to.public java.util.List getDigestAlgorithms()
|
Bouncy Castle Cryptography Library 1.79 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |