Skip navigation links

Oracle Security Developer Tools CMS Java API Reference
11g (11.1.1)

E10667-02


oracle.security.crypto.cms
Class CMSEnvelopedDataOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by oracle.security.crypto.cms.CMSOutputStream
              extended by oracle.security.crypto.cms.CMSEnvelopedDataOutputStream

All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class CMSEnvelopedDataOutputStream
extends CMSOutputStream

A CMSEnvelopedDataOutputStream writes its output in the form of a CMS enveloped-data structure, enveloping the data in the process.

Specifically, the effect of using this class is as if the following process took place:

except that the actual process is done in one pass, eliminating the necessity to accumulate all of the input data before writing any output.

In the case where a <ocde>CMSConnector is provided instead of a CMSOutputStream, only the exposed content i.e. the Content field of the ContentInfo structure minus the explicit [0] tag is written to the underlying output stream.

IMPORTANT: This class generates large CMS enveloped-data Objects more efficiently (Java VM memory usage) than the CMSEnvelopedDataContentInfo class.

See Also:
CMSOutputStream, CMSEnvelopedDataContentInfo, CMSEnvelopedDataOutputConnector

Field Summary

 

Fields inherited from class java.io.FilterOutputStream
out

 

Constructor Summary
CMSEnvelopedDataOutputStream(CMSOutputConnector conn, oracle.security.crypto.asn1.ASN1ObjectID enclosedContentType, oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID, java.util.Vector recipients, boolean writeContent)
          Creates a CMSEnvelopedDataOutputStream.
CMSEnvelopedDataOutputStream(CMSOutputConnector conn, oracle.security.crypto.asn1.ASN1ObjectID enclosedContentType, oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID, java.util.Vector recipients, boolean writeContent, OriginatorInfo origInfo, oracle.security.crypto.cert.AttributeSet unprotectedAttribs)
          Creates a CMSEnvelopedDataOutputStream.
CMSEnvelopedDataOutputStream(java.io.OutputStream out, oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID, java.util.Vector recipients)
          Creates a CMSEnvelopedDataOutputStream.
CMSEnvelopedDataOutputStream(java.io.OutputStream out, oracle.security.crypto.asn1.ASN1ObjectID enclosedContentType, oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID, java.util.Vector recipients)
          Creates a CMSEnvelopedDataOutputStream.
CMSEnvelopedDataOutputStream(java.io.OutputStream out, oracle.security.crypto.asn1.ASN1ObjectID enclosedContentType, oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID, java.util.Vector recipients, boolean writeContent)
          Creates a CMSEnvelopedDataOutputStream.
CMSEnvelopedDataOutputStream(java.io.OutputStream out, oracle.security.crypto.asn1.ASN1ObjectID enclosedContentType, oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID, java.util.Vector recipients, boolean writeContent, OriginatorInfo origInfo, oracle.security.crypto.cert.AttributeSet unprotectedAttribs)
          Creates a CMSEnvelopedDataOutputStream.

 

Method Summary
 void close()
           
 oracle.security.crypto.asn1.ASN1ObjectID getExposedContentType()
          Returns the content type of the data output to the underlying output stream.
 void terminate()
          Finish writing the enveloped-data structure.
 void write(byte[] b, int offset, int len)
           
 void write(int ch)
           

 

Methods inherited from class java.io.FilterOutputStream
flush, write

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

CMSEnvelopedDataOutputStream

public CMSEnvelopedDataOutputStream(java.io.OutputStream out,
                                    oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID,
                                    java.util.Vector recipients)
                             throws java.security.NoSuchAlgorithmException
Creates a CMSEnvelopedDataOutputStream.

The enclosed content type will be set to Data.

Note the changes in exceptions Exceptions not thrown -- AlgorithmIdentifierException Exceptions introduced -- NoSuchAlgorithmException

Parameters:
out - The output stream.
contentEncryptionAlgID - The content encryption algorithm.
recipients - The recipients (each element must be an instance of CMSRecipientInfoSpec).
Throws:
java.security.NoSuchAlgorithmException - Unrecognized encryption algorithm.

CMSEnvelopedDataOutputStream

public CMSEnvelopedDataOutputStream(java.io.OutputStream out,
                                    oracle.security.crypto.asn1.ASN1ObjectID enclosedContentType,
                                    oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID,
                                    java.util.Vector recipients)
                             throws java.security.NoSuchAlgorithmException
Creates a CMSEnvelopedDataOutputStream.

Note the changes in exceptions Exceptions not thrown -- AlgorithmIdentifierException Exceptions introduced -- NoSuchAlgorithmException

Parameters:
out - The output stream.
enclosedContentType - The content type of content being encrypted.
contentEncryptionAlgID - The content encryption algorithm.
recipients - The recipients (each element must be an instance of CMSRecipientInfoSpec).
Throws:
java.security.NoSuchAlgorithmException - Unrecognized encryption algorithm.

CMSEnvelopedDataOutputStream

public CMSEnvelopedDataOutputStream(java.io.OutputStream out,
                                    oracle.security.crypto.asn1.ASN1ObjectID enclosedContentType,
                                    oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID,
                                    java.util.Vector recipients,
                                    boolean writeContent)
                             throws java.security.NoSuchAlgorithmException
Creates a CMSEnvelopedDataOutputStream.

Note the changes in exceptions Exceptions not thrown -- AlgorithmIdentifierException Exceptions introduced -- NoSuchAlgorithmException

Parameters:
out - The output stream.
enclosedContentType - The content type of content being encrypted.
contentEncryptionAlgID - The content encryption algorithm.
recipients - The recipients (each element must be an instance of CMSRecipientInfoSpec).
writeContent - Indicates if enclosed content is to be written to the output stream.
Throws:
java.security.NoSuchAlgorithmException - Unrecognized encryption algorithm.

CMSEnvelopedDataOutputStream

public CMSEnvelopedDataOutputStream(java.io.OutputStream out,
                                    oracle.security.crypto.asn1.ASN1ObjectID enclosedContentType,
                                    oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID,
                                    java.util.Vector recipients,
                                    boolean writeContent,
                                    OriginatorInfo origInfo,
                                    oracle.security.crypto.cert.AttributeSet unprotectedAttribs)
                             throws java.security.NoSuchAlgorithmException
Creates a CMSEnvelopedDataOutputStream.

Note the changes in exceptions Exceptions not thrown -- AlgorithmIdentifierException Exceptions introduced -- NoSuchAlgorithmException

Parameters:
out - The output stream.
enclosedContentType - The content type of content being encrypted.
contentEncryptionAlgID - The content encryption algorithm.
recipients - The recipients (each element must be an instance of CMSRecipientInfoSpec).
writeContent - Indicates if enclosed content is to be written to the output stream.
origInfo - The OriginatorInfo.
unprotectedAttribs - The unprotected attributes.
Throws:
java.security.NoSuchAlgorithmException - Unrecognized encryption algorithm.

CMSEnvelopedDataOutputStream

public CMSEnvelopedDataOutputStream(CMSOutputConnector conn,
                                    oracle.security.crypto.asn1.ASN1ObjectID enclosedContentType,
                                    oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID,
                                    java.util.Vector recipients,
                                    boolean writeContent)
                             throws java.security.NoSuchAlgorithmException
Creates a CMSEnvelopedDataOutputStream.

Note the changes in exceptions Exceptions not thrown -- AlgorithmIdentifierException Exceptions introduced -- NoSuchAlgorithmException

Parameters:
conn - The output connector.
contentEncryptionAlgID - The content encryption algorithm.
recipients - The recipient certificates (each element must be an instance of CMSRecipientInfoSpec).
recipients - The recipients (each element must be an instance of CMSRecipientInfoSpec).
writeContent - Indicates if enclosed content is to be written to the output stream.
Throws:
java.security.NoSuchAlgorithmException - Unrecognized encryption algorithm.

CMSEnvelopedDataOutputStream

public CMSEnvelopedDataOutputStream(CMSOutputConnector conn,
                                    oracle.security.crypto.asn1.ASN1ObjectID enclosedContentType,
                                    oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID,
                                    java.util.Vector recipients,
                                    boolean writeContent,
                                    OriginatorInfo origInfo,
                                    oracle.security.crypto.cert.AttributeSet unprotectedAttribs)
                             throws java.security.NoSuchAlgorithmException
Creates a CMSEnvelopedDataOutputStream.

Note the changes in exceptions Exceptions not thrown -- AlgorithmIdentifierException Exceptions introduced -- NoSuchAlgorithmException

Parameters:
conn - The output connector.
enclosedContentType - The content type of content being encrypted.
contentEncryptionAlgID - The content encryption algorithm.
recipients - The recipients (each element must be an instance of CMSRecipientInfoSpec).
writeContent - Indicates if enclosed content is to be written to the output stream.
origInfo - The OriginatorInfo.
unprotectedAttribs - The set of unprotected attributes.
Throws:
java.security.NoSuchAlgorithmException - Unrecognized encryption algorithm.

Method Detail

terminate

public void terminate()
               throws java.io.IOException
Finish writing the enveloped-data structure.

This must be called only after all the enclosed data has been written to the output stream.

Specified by:
terminate in class CMSOutputStream
Throws:
java.io.IOException - An I/O error occurs.

write

public void write(int ch)
           throws java.io.IOException
Overrides:
write in class java.io.FilterOutputStream
Throws:
java.io.IOException

write

public void write(byte[] b,
                  int offset,
                  int len)
           throws java.io.IOException
Overrides:
write in class java.io.FilterOutputStream
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.FilterOutputStream
Throws:
java.io.IOException

getExposedContentType

public oracle.security.crypto.asn1.ASN1ObjectID getExposedContentType()
Returns the content type of the data output to the underlying output stream.
Specified by:
getExposedContentType in class CMSOutputStream
Returns:
The content type identifier.

Skip navigation links

Oracle Security Developer Tools CMS Java API Reference
11g (11.1.1)

E10667-02


Copyright © 2005, 2009, Oracle. All rights reserved.