public class CMSSignedDataStreamGenerator extends CMSSignedGenerator
A simple example of usage.
CertStore certs...
CMSSignedDataStreamGenerator gen = new CMSSignedDataStreamGenerator();
gen.addSigner(privateKey, cert, CMSSignedDataStreamGenerator.DIGEST_SHA1, GammaTechProvider.PROVIDER_NAME);
gen.addCertificatesAndCRLs(certs);
OutputStream sigOut = gen.open(bOut);
sigOut.write("Hello World!".getBytes());
sigOut.close();
| Modifier and Type | Class and Description |
|---|---|
private class |
CMSSignedDataStreamGenerator.CmsSignedDataOutputStream |
private class |
CMSSignedDataStreamGenerator.NullOutputStream |
private class |
CMSSignedDataStreamGenerator.SignerInf |
private class |
CMSSignedDataStreamGenerator.TeeOutputStream |
| Modifier and Type | Field and Description |
|---|---|
private int |
_bufferSize |
private java.util.List |
_messageDigests |
private java.util.List |
_signerInfs |
_certs, _crls, _digests, _signers, DATA, DIGEST_GOST3411, DIGEST_GOST3411_2012_256, DIGEST_GOST3411_2012_512, DIGEST_GOST3411G, DIGEST_KZ_GOST_34_11_95, DIGEST_KZ_GOST_34_11_95_TEST, DIGEST_MD5, DIGEST_SHA1, ENCRYPTION_DSA, ENCRYPTION_ECDSA, ENCRYPTION_ECGOST3410, ENCRYPTION_GOST3410, ENCRYPTION_GOST3410_2012, ENCRYPTION_GOST3410_2012_2, ENCRYPTION_KZ_GOST_34_310_SIGNATURE, ENCRYPTION_RECGOST3410, ENCRYPTION_RSA, ENCRYPTION_RSA_PSS| Constructor and Description |
|---|
CMSSignedDataStreamGenerator()
base constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addSigner(java.security.PrivateKey key,
java.security.cert.X509Certificate cert,
java.lang.String digestOID,
AttributeTable signedAttr,
AttributeTable unsignedAttr,
java.lang.String sigProvider)
add a signer with extra signed/unsigned attributes.
|
void |
addSigner(java.security.PrivateKey key,
java.security.cert.X509Certificate cert,
java.lang.String digestOID,
CMSAttributeTableGenerator signedAttrGenerator,
CMSAttributeTableGenerator unsignedAttrGenerator,
java.lang.String sigProvider) |
void |
addSigner(java.security.PrivateKey key,
java.security.cert.X509Certificate cert,
java.lang.String digestOID,
java.lang.String sigProvider)
add a signer - no attributes other than the default ones will be
provided here.
|
private DERInteger |
calculateVersion(java.lang.String contentOid) |
private boolean |
checkForVersion3(java.util.List signerInfos) |
private AlgorithmIdentifier |
makeAlgId(java.lang.String oid,
byte[] params) |
private DERObject |
makeObj(byte[] encoding) |
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".
|
java.io.OutputStream |
open(java.io.OutputStream out,
java.lang.String signedContentType,
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(java.io.OutputStream out,
java.lang.String signedContentType,
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.
|
void |
setBufferSize(int bufferSize)
Set the underlying string size for encapsulated data
|
addAttributeCertificates, addCertificatesAndCRLs, addSigners, getAttributeSet, getBaseParameters, getEncAlgorithmIdentifier, getEncOID, getGeneratedDigestsprivate java.util.List _signerInfs
private java.util.List _messageDigests
private int _bufferSize
public CMSSignedDataStreamGenerator()
public void setBufferSize(int bufferSize)
bufferSize - length of octet strings to buffer the data.public void addSigner(java.security.PrivateKey key,
java.security.cert.X509Certificate cert,
java.lang.String digestOID,
java.lang.String sigProvider)
throws java.security.NoSuchAlgorithmException,
java.security.NoSuchProviderException,
java.security.InvalidKeyException
java.security.NoSuchProviderExceptionjava.security.NoSuchAlgorithmExceptionjava.security.InvalidKeyExceptionpublic void addSigner(java.security.PrivateKey key,
java.security.cert.X509Certificate cert,
java.lang.String digestOID,
AttributeTable signedAttr,
AttributeTable unsignedAttr,
java.lang.String sigProvider)
throws java.security.NoSuchAlgorithmException,
java.security.NoSuchProviderException,
java.security.InvalidKeyException
java.security.NoSuchProviderExceptionjava.security.NoSuchAlgorithmExceptionjava.security.InvalidKeyExceptionpublic void addSigner(java.security.PrivateKey key,
java.security.cert.X509Certificate cert,
java.lang.String digestOID,
CMSAttributeTableGenerator signedAttrGenerator,
CMSAttributeTableGenerator unsignedAttrGenerator,
java.lang.String sigProvider)
throws java.security.NoSuchAlgorithmException,
java.security.NoSuchProviderException,
java.security.InvalidKeyException
java.security.NoSuchAlgorithmExceptionjava.security.NoSuchProviderExceptionjava.security.InvalidKeyExceptionprivate DERObject makeObj(byte[] encoding) throws java.io.IOException
java.io.IOExceptionprivate AlgorithmIdentifier makeAlgId(java.lang.String oid, byte[] params) throws java.io.IOException
java.io.IOExceptionpublic java.io.OutputStream open(java.io.OutputStream out)
throws java.io.IOException
java.io.IOExceptionpublic java.io.OutputStream open(java.io.OutputStream out,
boolean encapsulate)
throws java.io.IOException
java.io.IOExceptionpublic 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.java.io.IOExceptionpublic java.io.OutputStream open(java.io.OutputStream out,
java.lang.String signedContentType,
boolean encapsulate)
throws java.io.IOException
java.io.IOExceptionpublic java.io.OutputStream open(java.io.OutputStream out,
java.lang.String signedContentType,
boolean encapsulate,
java.io.OutputStream dataOutputStream)
throws java.io.IOException
out - stream the CMS object is to be written to.signedContentType - OID for data to be signed.encapsulate - true if data should be encapsulated.dataOutputStream - output stream to copy the data being signed to.java.io.IOExceptionprivate DERInteger calculateVersion(java.lang.String contentOid)
private boolean checkForVersion3(java.util.List signerInfos)
Copyright © 1998-2014 Gamma Technologies. All Rights Reserved.