A simple example of usage.
CMSEnvelopedDataStreamGenerator edGen = new CMSEnvelopedDataStreamGenerator();
edGen.addRecipientInfoGenerator(new JceKeyTransRecipientInfoGenerator(recipientCert).setProvider("BC"));
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
OutputStream out = edGen.open(
bOut, new JceCMSContentEncryptorBuilder(CMSAlgorithm.DES_EDE3_CBC)
.setProvider("BC").build());
out.write(data);
out.close();
| Modifier and Type | Class and Description |
|---|---|
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private OutputStream | |
| private ASN1Integer | |
| protected OutputStream | open(ASN1ObjectIdentifier dataType, OutputStream out, ASN1EncodableVector recipientInfos, OutputEncryptor encryptor)
|
| protected OutputStream | |
| public OutputStream | open(OutputStream out, OutputEncryptor encryptor)
generate an enveloped object that contains an CMS Enveloped Data object using the given encryptor. |
| public OutputStream | open(ASN1ObjectIdentifier dataType, OutputStream out, OutputEncryptor encryptor)
generate an enveloped object that contains an CMS Enveloped Data object using the given encryptor and marking the data as being of the passed in type. |
| public void | setBEREncodeRecipients(boolean berEncodeRecipientSet)
Use a BER Set to store the recipient information |
| public void | setBufferSize(int
length of octet strings to buffer the data. bufferSize)Set the underlying string size for encapsulated data |
| _berEncodeRecipientSet | back to summary |
|---|---|
| private boolean _berEncodeRecipientSet | |
| _bufferSize | back to summary |
|---|---|
| private int _bufferSize | |
| CMSEnvelopedDataStreamGenerator | back to summary |
|---|---|
| public CMSEnvelopedDataStreamGenerator() base constructor | |
| doOpen | back to summary |
|---|---|
| private OutputStream doOpen(ASN1ObjectIdentifier dataType, OutputStream out, OutputEncryptor encryptor) throws IOException, CMSException | |
| getVersion | back to summary |
|---|---|
| private ASN1Integer getVersion(ASN1EncodableVector recipientInfos) | |
| open | back to summary |
|---|---|
| protected OutputStream open(ASN1ObjectIdentifier dataType, OutputStream out, ASN1EncodableVector recipientInfos, OutputEncryptor encryptor) throws IOException | |
| open | back to summary |
|---|---|
| protected OutputStream open(OutputStream out, ASN1EncodableVector recipientInfos, OutputEncryptor encryptor) throws CMSException | |
| open | back to summary |
|---|---|
| public OutputStream open(OutputStream out, OutputEncryptor encryptor) throws CMSException, IOException generate an enveloped object that contains an CMS Enveloped Data object using the given encryptor. | |
| open | back to summary |
|---|---|
| public OutputStream open(ASN1ObjectIdentifier dataType, OutputStream out, OutputEncryptor encryptor) throws CMSException, IOException generate an enveloped object that contains an CMS Enveloped Data object using the given encryptor and marking the data as being of the passed in type. | |
| setBEREncodeRecipients | back to summary |
|---|---|
| public void setBEREncodeRecipients(boolean berEncodeRecipientSet) Use a BER Set to store the recipient information | |
| setBufferSize | back to summary |
|---|---|
| public void setBufferSize(int bufferSize) Set the underlying string size for encapsulated data
| |
| Modifier and Type | Field and Description |
|---|---|
| private BERSequenceGenerator | |
| private final OutputStream | |
| private BERSequenceGenerator | |
| private final OutputEncryptor | |
| private BERSequenceGenerator | |
| private OutputStream |
| Access | Constructor and Description |
|---|---|
| public | CmsEnvelopedDataOutputStream(OutputEncryptor encryptor, OutputStream octetStream, BERSequenceGenerator cGen, BERSequenceGenerator envGen, BERSequenceGenerator eiGen)
|
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Overrides java. Implements java. Closes this output stream and releases any system resources associated with this stream. |
| public void | write(int
the b)byte.Implements abstract java. Writes the specified byte to this output stream. |
| public void | write(byte[]
the data. bytes, int the start offset in the data. off, int the number of bytes to write. len)Overrides java. Writes |
| public void | write(byte[]
the data. bytes)Overrides java. Writes |
| _cGen | back to summary |
|---|---|
| private BERSequenceGenerator _cGen | |
| _cOut | back to summary |
|---|---|
| private final OutputStream _cOut | |
| _eiGen | back to summary |
|---|---|
| private BERSequenceGenerator _eiGen | |
| _encryptor | back to summary |
|---|---|
| private final OutputEncryptor _encryptor | |
| _envGen | back to summary |
|---|---|
| private BERSequenceGenerator _envGen | |
| _octetStream | back to summary |
|---|---|
| private OutputStream _octetStream | |
| CmsEnvelopedDataOutputStream | back to summary |
|---|---|
| public CmsEnvelopedDataOutputStream(OutputEncryptor encryptor, OutputStream octetStream, BERSequenceGenerator cGen, BERSequenceGenerator envGen, BERSequenceGenerator eiGen) | |
| close | back to summary |
|---|---|
| public void close() throws IOException Overrides java. Implements java. Doc from java. Closes this output stream and releases any system resources
associated with this stream. The general contract of
| |
| write | back to summary |
|---|---|
| public void write(int b) throws IOException Implements abstract java. Doc from java. Writes the specified byte to this output stream. The general
contract for
| |
| write | back to summary |
|---|---|
| public void write(byte[] bytes, int off, int len) throws IOException Overrides java. Doc from java. Writes
If
If
| |
| write | back to summary |
|---|---|
| public void write(byte[] bytes) throws IOException Overrides java. Doc from java. Writes
| |