A simple example of usage.
CMSAuthenticatedDataStreamGenerator edGen = new CMSAuthenticatedDataStreamGenerator();
edGen.addRecipientInfoGenerator(new JceKeyTransRecipientInfoGenerator(cert).setProvider("BC"));
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
OutputStream out = edGen.open(
bOut, new JceCMSMacCalculatorBuilder(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 | |
| private MacCalculator |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public OutputStream | open(OutputStream
the stream to store the authenticated structure in. out, MacCalculator calculator for the MAC to be attached to the data. macCalculator)generate an authenticated data structure with the encapsulated bytes marked as DATA. |
| public OutputStream | |
| public OutputStream | open(ASN1ObjectIdentifier
the type of the data been written to the object. dataType, OutputStream the stream to store the authenticated structure in. out, MacCalculator calculator for the MAC to be attached to the data. macCalculator)generate an authenticated data structure with the encapsulated bytes marked as type dataType. |
| public OutputStream | open(ASN1ObjectIdentifier
the type of the data been written to the object. dataType, OutputStream the stream to store the authenticated structure in. out, MacCalculator calculator for the MAC to be attached to the data. macCalculator, DigestCalculator calculator for computing digest of the encapsulated data. digestCalculator)generate an authenticated data structure with the encapsulated bytes marked as type dataType. |
| public void | setBEREncodeRecipients(boolean
true if a BER set should be used, false if DER. useBerEncodingForRecipients)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 | |
| macCalculator | back to summary |
|---|---|
| private MacCalculator macCalculator | |
| CMSAuthenticatedDataStreamGenerator | back to summary |
|---|---|
| public CMSAuthenticatedDataStreamGenerator() base constructor | |
| open | back to summary |
|---|---|
| public OutputStream open(OutputStream out, MacCalculator macCalculator) throws CMSException generate an authenticated data structure with the encapsulated bytes marked as DATA.
| |
| open | back to summary |
|---|---|
| public OutputStream open(OutputStream out, MacCalculator macCalculator, DigestCalculator digestCalculator) throws CMSException | |
| open | back to summary |
|---|---|
| public OutputStream open(ASN1ObjectIdentifier dataType, OutputStream out, MacCalculator macCalculator) throws CMSException generate an authenticated data structure with the encapsulated bytes marked as type dataType.
| |
| open | back to summary |
|---|---|
| public OutputStream open(ASN1ObjectIdentifier dataType, OutputStream out, MacCalculator macCalculator, DigestCalculator digestCalculator) throws CMSException generate an authenticated data structure with the encapsulated bytes marked as type dataType.
| |
| setBEREncodeRecipients | back to summary |
|---|---|
| public void setBEREncodeRecipients(boolean useBerEncodingForRecipients) Use a BER Set to store the recipient information. By default recipients are stored in a DER encoding.
| |
| 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 ASN1ObjectIdentifier | |
| private OutputStream | |
| private DigestCalculator | |
| private BERSequenceGenerator | |
| private BERSequenceGenerator | |
| private MacCalculator |
| Access | Constructor and Description |
|---|---|
| public | CmsAuthenticatedDataOutputStream(MacCalculator macCalculator, DigestCalculator digestCalculator, ASN1ObjectIdentifier contentType, OutputStream dataStream, BERSequenceGenerator cGen, BERSequenceGenerator envGen, BERSequenceGenerator eiGen)
|
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Overrides java. Implements java. |
| public void | write(int
the b)byte.Implements abstract java. |
| 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. len bytes from the specified byte array
starting at offset off to this output stream.
|
| public void | write(byte[]
the data. bytes)Overrides java. b.length bytes from the specified byte array
to this output stream.
|
| cGen | back to summary |
|---|---|
| private BERSequenceGenerator cGen | |
| contentType | back to summary |
|---|---|
| private ASN1ObjectIdentifier contentType | |
| dataStream | back to summary |
|---|---|
| private OutputStream dataStream | |
| digestCalculator | back to summary |
|---|---|
| private DigestCalculator digestCalculator | |
| eiGen | back to summary |
|---|---|
| private BERSequenceGenerator eiGen | |
| envGen | back to summary |
|---|---|
| private BERSequenceGenerator envGen | |
| macCalculator | back to summary |
|---|---|
| private MacCalculator macCalculator | |
| CmsAuthenticatedDataOutputStream | back to summary |
|---|---|
| public CmsAuthenticatedDataOutputStream(MacCalculator macCalculator, DigestCalculator digestCalculator, ASN1ObjectIdentifier contentType, OutputStream dataStream, 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
| |