public class CMSSignedDataStreamGenerator extends CMSSignedGenerator
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();
_signers, certs, crls, DATA, DIGEST_GOST3411, DIGEST_MD5, DIGEST_RIPEMD128, DIGEST_RIPEMD160, DIGEST_RIPEMD256, DIGEST_SHA1, DIGEST_SHA224, DIGEST_SHA256, DIGEST_SHA384, DIGEST_SHA512, digests, ENCRYPTION_DSA, ENCRYPTION_ECDSA, ENCRYPTION_ECGOST3410, ENCRYPTION_GOST3410, ENCRYPTION_RSA, ENCRYPTION_RSA_PSS, rand, signerGens
Constructor and Description |
---|
CMSSignedDataStreamGenerator()
base constructor
|
CMSSignedDataStreamGenerator(SecureRandom rand)
constructor allowing specific source of randomness
|
Modifier and Type | Method and Description |
---|---|
void |
addSigner(PrivateKey key,
byte[] subjectKeyID,
String digestOID,
AttributeTable signedAttr,
AttributeTable unsignedAttr,
Provider sigProvider)
Deprecated.
use addSignerInfoGenerator
|
void |
addSigner(PrivateKey key,
byte[] subjectKeyID,
String digestOID,
AttributeTable signedAttr,
AttributeTable unsignedAttr,
String sigProvider)
Deprecated.
use addSignerInfoGenerator
|
void |
addSigner(PrivateKey key,
byte[] subjectKeyID,
String digestOID,
CMSAttributeTableGenerator signedAttrGenerator,
CMSAttributeTableGenerator unsignedAttrGenerator,
Provider sigProvider)
Deprecated.
use addSignerInfoGenerator
|
void |
addSigner(PrivateKey key,
byte[] subjectKeyID,
String digestOID,
CMSAttributeTableGenerator signedAttrGenerator,
CMSAttributeTableGenerator unsignedAttrGenerator,
String sigProvider)
Deprecated.
use addSignerInfoGenerator
|
void |
addSigner(PrivateKey key,
byte[] subjectKeyID,
String digestOID,
Provider sigProvider)
Deprecated.
use addSignedInfoGenerator
|
void |
addSigner(PrivateKey key,
byte[] subjectKeyID,
String digestOID,
String sigProvider)
Deprecated.
use addSignedInfoGenerator
|
void |
addSigner(PrivateKey key,
byte[] subjectKeyID,
String encryptionOID,
String digestOID,
CMSAttributeTableGenerator signedAttrGenerator,
CMSAttributeTableGenerator unsignedAttrGenerator,
Provider sigProvider)
Deprecated.
use addSignerInfoGenerator
|
void |
addSigner(PrivateKey key,
byte[] subjectKeyID,
String encryptionOID,
String digestOID,
CMSAttributeTableGenerator signedAttrGenerator,
CMSAttributeTableGenerator unsignedAttrGenerator,
Provider sigProvider,
Provider digProvider)
Deprecated.
use addSignerInfoGenerator
|
void |
addSigner(PrivateKey key,
byte[] subjectKeyID,
String encryptionOID,
String digestOID,
CMSAttributeTableGenerator signedAttrGenerator,
CMSAttributeTableGenerator unsignedAttrGenerator,
String sigProvider)
Deprecated.
use addSignerInfoGenerator
|
void |
addSigner(PrivateKey key,
byte[] subjectKeyID,
String encryptionOID,
String digestOID,
Provider sigProvider)
Deprecated.
use addSignerInfoGenerator
|
void |
addSigner(PrivateKey key,
byte[] subjectKeyID,
String encryptionOID,
String digestOID,
String sigProvider)
Deprecated.
use addSignedInfoGenerator
|
void |
addSigner(PrivateKey key,
X509Certificate cert,
String digestOID,
AttributeTable signedAttr,
AttributeTable unsignedAttr,
Provider sigProvider)
Deprecated.
use addSignedInfoGenerator
|
void |
addSigner(PrivateKey key,
X509Certificate cert,
String digestOID,
AttributeTable signedAttr,
AttributeTable unsignedAttr,
String sigProvider)
Deprecated.
use addSignedInfoGenerator
|
void |
addSigner(PrivateKey key,
X509Certificate cert,
String digestOID,
CMSAttributeTableGenerator signedAttrGenerator,
CMSAttributeTableGenerator unsignedAttrGenerator,
Provider sigProvider)
Deprecated.
use addSignedInfoGenerator
|
void |
addSigner(PrivateKey key,
X509Certificate cert,
String digestOID,
CMSAttributeTableGenerator signedAttrGenerator,
CMSAttributeTableGenerator unsignedAttrGenerator,
String sigProvider)
Deprecated.
use addSignedInfoGenerator
|
void |
addSigner(PrivateKey key,
X509Certificate cert,
String digestOID,
Provider sigProvider)
Deprecated.
use addSignedInfoGenerator
|
void |
addSigner(PrivateKey key,
X509Certificate cert,
String digestOID,
String sigProvider)
Deprecated.
use addSignedInfoGenerator
|
void |
addSigner(PrivateKey key,
X509Certificate cert,
String encryptionOID,
String digestOID,
AttributeTable signedAttr,
AttributeTable unsignedAttr,
Provider sigProvider)
Deprecated.
use addSignedInfoGenerator
|
void |
addSigner(PrivateKey key,
X509Certificate cert,
String encryptionOID,
String digestOID,
AttributeTable signedAttr,
AttributeTable unsignedAttr,
String sigProvider)
Deprecated.
use addSignedInfoGenerator
|
void |
addSigner(PrivateKey key,
X509Certificate cert,
String encryptionOID,
String digestOID,
CMSAttributeTableGenerator signedAttrGenerator,
CMSAttributeTableGenerator unsignedAttrGenerator,
Provider sigProvider)
Deprecated.
use addSignedInfoGenerator
|
void |
addSigner(PrivateKey key,
X509Certificate cert,
String encryptionOID,
String digestOID,
CMSAttributeTableGenerator signedAttrGenerator,
CMSAttributeTableGenerator unsignedAttrGenerator,
Provider sigProvider,
Provider digProvider)
Deprecated.
use addSignerInfoGenerator
|
void |
addSigner(PrivateKey key,
X509Certificate cert,
String encryptionOID,
String digestOID,
CMSAttributeTableGenerator signedAttrGenerator,
CMSAttributeTableGenerator unsignedAttrGenerator,
String sigProvider)
Deprecated.
use addSignedInfoGenerator
|
void |
addSigner(PrivateKey key,
X509Certificate cert,
String encryptionOID,
String digestOID,
Provider sigProvider)
Deprecated.
use addSignedInfoGenerator
|
void |
addSigner(PrivateKey key,
X509Certificate cert,
String encryptionOID,
String digestOID,
String sigProvider)
Deprecated.
use addSignedInfoGenerator
|
OutputStream |
open(ASN1ObjectIdentifier eContentType,
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.
|
OutputStream |
open(ASN1ObjectIdentifier eContentType,
OutputStream out,
boolean encapsulate,
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.
|
OutputStream |
open(OutputStream out)
generate a signed object that for a CMS Signed Data
object using the given provider.
|
OutputStream |
open(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".
|
OutputStream |
open(OutputStream out,
boolean encapsulate,
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".
|
OutputStream |
open(OutputStream out,
String eContentType,
boolean encapsulate)
Deprecated.
use open(ASN1ObjectIdentifier, OutputStream, boolean)
|
OutputStream |
open(OutputStream out,
String eContentType,
boolean encapsulate,
OutputStream dataOutputStream)
Deprecated.
use open(ASN1ObjectIdenfier, OutputStream, boolean, OutputStream)
|
void |
setBufferSize(int bufferSize)
Set the underlying string size for encapsulated data
|
addAttributeCertificates, addAttributeCertificates, addCertificates, addCertificatesAndCRLs, addCRLs, addSignerInfoGenerator, addSigners, getAttributeSet, getBaseParameters, getEncAlgorithmIdentifier, getEncOID, getGeneratedDigests
public CMSSignedDataStreamGenerator()
public CMSSignedDataStreamGenerator(SecureRandom rand)
rand
- instance of SecureRandom to usepublic void setBufferSize(int bufferSize)
bufferSize
- length of octet strings to buffer the data.public void addSigner(PrivateKey key, X509Certificate cert, String digestOID, String sigProvider) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException
public void addSigner(PrivateKey key, X509Certificate cert, String digestOID, Provider sigProvider) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException
public void addSigner(PrivateKey key, X509Certificate cert, String encryptionOID, String digestOID, String sigProvider) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException
public void addSigner(PrivateKey key, X509Certificate cert, String encryptionOID, String digestOID, Provider sigProvider) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException
public void addSigner(PrivateKey key, X509Certificate cert, String digestOID, AttributeTable signedAttr, AttributeTable unsignedAttr, String sigProvider) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException
public void addSigner(PrivateKey key, X509Certificate cert, String digestOID, AttributeTable signedAttr, AttributeTable unsignedAttr, Provider sigProvider) throws NoSuchAlgorithmException, InvalidKeyException
public void addSigner(PrivateKey key, X509Certificate cert, String encryptionOID, String digestOID, AttributeTable signedAttr, AttributeTable unsignedAttr, String sigProvider) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException
public void addSigner(PrivateKey key, X509Certificate cert, String encryptionOID, String digestOID, AttributeTable signedAttr, AttributeTable unsignedAttr, Provider sigProvider) throws NoSuchAlgorithmException, InvalidKeyException
public void addSigner(PrivateKey key, X509Certificate cert, String digestOID, CMSAttributeTableGenerator signedAttrGenerator, CMSAttributeTableGenerator unsignedAttrGenerator, String sigProvider) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException
public void addSigner(PrivateKey key, X509Certificate cert, String digestOID, CMSAttributeTableGenerator signedAttrGenerator, CMSAttributeTableGenerator unsignedAttrGenerator, Provider sigProvider) throws NoSuchAlgorithmException, InvalidKeyException
public void addSigner(PrivateKey key, X509Certificate cert, String encryptionOID, String digestOID, CMSAttributeTableGenerator signedAttrGenerator, CMSAttributeTableGenerator unsignedAttrGenerator, String sigProvider) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException
public void addSigner(PrivateKey key, X509Certificate cert, String encryptionOID, String digestOID, CMSAttributeTableGenerator signedAttrGenerator, CMSAttributeTableGenerator unsignedAttrGenerator, Provider sigProvider) throws NoSuchAlgorithmException, InvalidKeyException
public void addSigner(PrivateKey key, byte[] subjectKeyID, String digestOID, String sigProvider) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException
public void addSigner(PrivateKey key, byte[] subjectKeyID, String digestOID, Provider sigProvider) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException
public void addSigner(PrivateKey key, byte[] subjectKeyID, String encryptionOID, String digestOID, String sigProvider) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException
public void addSigner(PrivateKey key, byte[] subjectKeyID, String encryptionOID, String digestOID, Provider sigProvider) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException
public void addSigner(PrivateKey key, byte[] subjectKeyID, String digestOID, AttributeTable signedAttr, AttributeTable unsignedAttr, String sigProvider) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException
public void addSigner(PrivateKey key, byte[] subjectKeyID, String digestOID, AttributeTable signedAttr, AttributeTable unsignedAttr, Provider sigProvider) throws NoSuchAlgorithmException, InvalidKeyException
public void addSigner(PrivateKey key, byte[] subjectKeyID, String digestOID, CMSAttributeTableGenerator signedAttrGenerator, CMSAttributeTableGenerator unsignedAttrGenerator, String sigProvider) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException
public void addSigner(PrivateKey key, byte[] subjectKeyID, String digestOID, CMSAttributeTableGenerator signedAttrGenerator, CMSAttributeTableGenerator unsignedAttrGenerator, Provider sigProvider) throws NoSuchAlgorithmException, InvalidKeyException
public void addSigner(PrivateKey key, byte[] subjectKeyID, String encryptionOID, String digestOID, CMSAttributeTableGenerator signedAttrGenerator, CMSAttributeTableGenerator unsignedAttrGenerator, String sigProvider) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException
public void addSigner(PrivateKey key, byte[] subjectKeyID, String encryptionOID, String digestOID, CMSAttributeTableGenerator signedAttrGenerator, CMSAttributeTableGenerator unsignedAttrGenerator, Provider sigProvider) throws NoSuchAlgorithmException, InvalidKeyException
public void addSigner(PrivateKey key, X509Certificate cert, String encryptionOID, String digestOID, CMSAttributeTableGenerator signedAttrGenerator, CMSAttributeTableGenerator unsignedAttrGenerator, Provider sigProvider, Provider digProvider) throws NoSuchAlgorithmException, InvalidKeyException
public void addSigner(PrivateKey key, byte[] subjectKeyID, String encryptionOID, String digestOID, CMSAttributeTableGenerator signedAttrGenerator, CMSAttributeTableGenerator unsignedAttrGenerator, Provider sigProvider, Provider digProvider) throws NoSuchAlgorithmException, InvalidKeyException
public OutputStream open(OutputStream out) throws IOException
IOException
public OutputStream open(OutputStream out, boolean encapsulate) throws IOException
IOException
public OutputStream open(OutputStream out, boolean encapsulate, OutputStream dataOutputStream) throws 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.IOException
public OutputStream open(OutputStream out, String eContentType, boolean encapsulate) throws IOException
IOException
public OutputStream open(ASN1ObjectIdentifier eContentType, OutputStream out, boolean encapsulate) throws IOException
IOException
public OutputStream open(OutputStream out, String eContentType, boolean encapsulate, OutputStream dataOutputStream) throws IOException
IOException
public OutputStream open(ASN1ObjectIdentifier eContentType, OutputStream out, boolean encapsulate, OutputStream dataOutputStream) throws 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.IOException
Copyright © 2015. All rights reserved.