Oracle Security Developer Tools CMS Java API Reference
10g Release 2 (10.1.2.0.2)

B15564-01


oracle.security.crypto.cms
Class CMSEnvelopedDataOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byjava.io.FilterOutputStream
          extended byoracle.security.crypto.cms.CMSOutputStream
              extended byoracle.security.crypto.cms.CMSEnvelopedDataOutputStream


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, ASN1ObjectID enclosedContentType, AlgorithmIdentifier contentEncryptionAlgID, java.util.Vector recipients, boolean writeContent)
Creates a CMSEnvelopedDataOutputStream.
CMSEnvelopedDataOutputStream(CMSOutputConnector conn, ASN1ObjectID enclosedContentType, AlgorithmIdentifier contentEncryptionAlgID, java.util.Vector recipients, boolean writeContent, OriginatorInfo origInfo, oracle.security.crypto.cert.AttributeSet unprotectedAttribs)
Creates a CMSEnvelopedDataOutputStream.
CMSEnvelopedDataOutputStream(java.io.OutputStream out, AlgorithmIdentifier contentEncryptionAlgID, java.util.Vector recipients)
Creates a CMSEnvelopedDataOutputStream.
CMSEnvelopedDataOutputStream(java.io.OutputStream out, ASN1ObjectID enclosedContentType, AlgorithmIdentifier contentEncryptionAlgID, java.util.Vector recipients)
Creates a CMSEnvelopedDataOutputStream.
CMSEnvelopedDataOutputStream(java.io.OutputStream out, ASN1ObjectID enclosedContentType, AlgorithmIdentifier contentEncryptionAlgID, java.util.Vector recipients, boolean writeContent)
Creates a CMSEnvelopedDataOutputStream.
CMSEnvelopedDataOutputStream(java.io.OutputStream out, ASN1ObjectID enclosedContentType, AlgorithmIdentifier contentEncryptionAlgID, java.util.Vector recipients, boolean writeContent, OriginatorInfo origInfo, oracle.security.crypto.cert.AttributeSet unprotectedAttribs)
Creates a CMSEnvelopedDataOutputStream.

Method Summary
void close()
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,
                                    AlgorithmIdentifier contentEncryptionAlgID,
                                    java.util.Vector recipients)
                             throws AlgorithmIdentifierException
Creates a CMSEnvelopedDataOutputStream.

The enclosed content type will be set to Data.

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

CMSEnvelopedDataOutputStream

public CMSEnvelopedDataOutputStream(java.io.OutputStream out,
                                    ASN1ObjectID enclosedContentType,
                                    AlgorithmIdentifier contentEncryptionAlgID,
                                    java.util.Vector recipients)
                             throws AlgorithmIdentifierException
Creates a CMSEnvelopedDataOutputStream.
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:
AlgorithmIdentifierException - Unrecognized encryption algorithm.

CMSEnvelopedDataOutputStream

public CMSEnvelopedDataOutputStream(java.io.OutputStream out,
                                    ASN1ObjectID enclosedContentType,
                                    AlgorithmIdentifier contentEncryptionAlgID,
                                    java.util.Vector recipients,
                                    boolean writeContent)
                             throws AlgorithmIdentifierException
Creates a CMSEnvelopedDataOutputStream.
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:
AlgorithmIdentifierException - Unrecognized encryption algorithm.

CMSEnvelopedDataOutputStream

public CMSEnvelopedDataOutputStream(java.io.OutputStream out,
                                    ASN1ObjectID enclosedContentType,
                                    AlgorithmIdentifier contentEncryptionAlgID,
                                    java.util.Vector recipients,
                                    boolean writeContent,
                                    OriginatorInfo origInfo,
                                    oracle.security.crypto.cert.AttributeSet unprotectedAttribs)
                             throws AlgorithmIdentifierException
Creates a CMSEnvelopedDataOutputStream.
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:
AlgorithmIdentifierException - Unrecognized encryption algorithm.

CMSEnvelopedDataOutputStream

public CMSEnvelopedDataOutputStream(CMSOutputConnector conn,
                                    ASN1ObjectID enclosedContentType,
                                    AlgorithmIdentifier contentEncryptionAlgID,
                                    java.util.Vector recipients,
                                    boolean writeContent)
                             throws AlgorithmIdentifierException
Creates a CMSEnvelopedDataOutputStream.
Parameters:
conn - The output connector.
contentEncryptionAlgID - The content encryption algorithm.
recipients - The recipient certificates (each element must be an instance of CMSRecipientInfoSpec).
writeContent - Indicates if enclosed content is to be written to the output stream.
Throws:
AlgorithmIdentifierException - Unrecognized encryption algorithm.

CMSEnvelopedDataOutputStream

public CMSEnvelopedDataOutputStream(CMSOutputConnector conn,
                                    ASN1ObjectID enclosedContentType,
                                    AlgorithmIdentifier contentEncryptionAlgID,
                                    java.util.Vector recipients,
                                    boolean writeContent,
                                    OriginatorInfo origInfo,
                                    oracle.security.crypto.cert.AttributeSet unprotectedAttribs)
                             throws AlgorithmIdentifierException
Creates a CMSEnvelopedDataOutputStream.
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:
AlgorithmIdentifierException - 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
Throws:
java.io.IOException

write

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

close

public void close()
           throws java.io.IOException
Throws:
java.io.IOException

getExposedContentType

public 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.

Oracle Security Developer Tools CMS Java API Reference
10g Release 2 (10.1.2.0.2)

B15564-01


Copyright © 2005 , Oracle. All rights reserved.