Oracle Security Developer Tools CMS Java API Reference
10g (10.1.4.0.1)

B28170-01


oracle.security.crypto.cms
Class CMSEncryptedDataOutputStream

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


public class CMSEncryptedDataOutputStream
extends CMSOutputStream

A CMSEncryptedDataOutputStream writes its output in the form of a CMS encrypted-data structure, encrypting 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 encrypted-data Objects more efficiently (Java VM memory usage) than the CMSEncryptedDataContentInfo class.

See Also:
CMSOutputStream, CMSEncryptedDataContentInfo, CMSEncryptedDataOutputConnector

Field Summary

 

Fields inherited from class java.io.FilterOutputStream
out

 

Constructor Summary
CMSEncryptedDataOutputStream(CMSOutputConnector conn, oracle.security.crypto.core.SymmetricKey contentEncryptionKey, oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID, oracle.security.crypto.asn1.ASN1ObjectID enclosedContentType)
          Creates a CMSEncryptedDataOutputStream.
CMSEncryptedDataOutputStream(CMSOutputConnector conn, oracle.security.crypto.core.SymmetricKey contentEncryptionKey, oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID, oracle.security.crypto.asn1.ASN1ObjectID enclosedContentType, oracle.security.crypto.cert.AttributeSet unprotectedAttributes)
          Creates a CMSEncryptedDataOutputStream.
CMSEncryptedDataOutputStream(CMSOutputConnector conn, oracle.security.crypto.core.SymmetricKey contentEncryptionKey, oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID, oracle.security.crypto.asn1.ASN1ObjectID enclosedContentType, oracle.security.crypto.cert.AttributeSet unprotectedAttributes, boolean writeEncryptedOutput)
          Creates a CMSEncryptedDataOutputStream.
CMSEncryptedDataOutputStream(java.io.OutputStream out, oracle.security.crypto.core.SymmetricKey contentEncryptionKey, oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID, oracle.security.crypto.asn1.ASN1ObjectID enclosedContentType)
          Creates a CMSEncryptedDataOutputStream.
CMSEncryptedDataOutputStream(java.io.OutputStream out, oracle.security.crypto.core.SymmetricKey contentEncryptionKey, oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID, oracle.security.crypto.asn1.ASN1ObjectID enclosedContentType, oracle.security.crypto.cert.AttributeSet unprotectedAttributes)
          Creates a CMSEncryptedDataOutputStream.
CMSEncryptedDataOutputStream(java.io.OutputStream out, oracle.security.crypto.core.SymmetricKey contentEncryptionKey, oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID, oracle.security.crypto.asn1.ASN1ObjectID enclosedContentType, oracle.security.crypto.cert.AttributeSet unprotectedAttributes, boolean writeEncryptedOutput)
          Creates a CMSEncryptedDataOutputStream.

 

Method Summary
 void close()
           
 oracle.security.crypto.asn1.ASN1ObjectID getExposedContentType()
          Returns the content type of the data that is output to the underlying output stream.
 void terminate()
          Finish writing the encrypted-data structure to the underlying output stream.
 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

CMSEncryptedDataOutputStream

public CMSEncryptedDataOutputStream(java.io.OutputStream out,
                                    oracle.security.crypto.core.SymmetricKey contentEncryptionKey,
                                    oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID,
                                    oracle.security.crypto.asn1.ASN1ObjectID enclosedContentType)
                             throws oracle.security.crypto.core.AlgorithmIdentifierException,
                                    oracle.security.crypto.core.InvalidKeyException
Creates a CMSEncryptedDataOutputStream.
Parameters:
out - The underlying output stream.
contentEncryptionKey - The content encryption key.
contentEncryptionAlgID - The content encryption algorithm.
enclosedContentType - The content type of the enclosed content.
Throws:
oracle.security.crypto.core.AlgorithmIdentifierException - The encryption algorithm is not supported.
oracle.security.crypto.core.InvalidKeyException - The encryption key is invalid.

CMSEncryptedDataOutputStream

public CMSEncryptedDataOutputStream(java.io.OutputStream out,
                                    oracle.security.crypto.core.SymmetricKey contentEncryptionKey,
                                    oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID,
                                    oracle.security.crypto.asn1.ASN1ObjectID enclosedContentType,
                                    oracle.security.crypto.cert.AttributeSet unprotectedAttributes)
                             throws oracle.security.crypto.core.AlgorithmIdentifierException,
                                    oracle.security.crypto.core.InvalidKeyException
Creates a CMSEncryptedDataOutputStream.
Parameters:
out - The underlying output stream.
contentEncryptionKey - The content encryption key.
contentEncryptionAlgID - The content encryption algorithm.
enclosedContentType - The content type of the enclosed content.
unprotectedAttributes - The set of unprotected attributes.
Throws:
oracle.security.crypto.core.AlgorithmIdentifierException - The encryption algorithm is not supported.
oracle.security.crypto.core.InvalidKeyException - The encryption key is invalid.

CMSEncryptedDataOutputStream

public CMSEncryptedDataOutputStream(java.io.OutputStream out,
                                    oracle.security.crypto.core.SymmetricKey contentEncryptionKey,
                                    oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID,
                                    oracle.security.crypto.asn1.ASN1ObjectID enclosedContentType,
                                    oracle.security.crypto.cert.AttributeSet unprotectedAttributes,
                                    boolean writeEncryptedOutput)
                             throws oracle.security.crypto.core.AlgorithmIdentifierException,
                                    oracle.security.crypto.core.InvalidKeyException
Creates a CMSEncryptedDataOutputStream.
Parameters:
out - The underlying output stream.
contentEncryptionKey - The content encryption key.
contentEncryptionAlgID - The content encryption algorithm.
enclosedContentType - The content type of the enclosed content.
unprotectedAttributes - The set of unprotected attributes.
writeEncryptedOutput - If true the encryptedContent will be written to the output stream; false otherwise.
Throws:
oracle.security.crypto.core.AlgorithmIdentifierException - The encryption algorithm is not supported.
oracle.security.crypto.core.InvalidKeyException - The encryption key is invalid.

CMSEncryptedDataOutputStream

public CMSEncryptedDataOutputStream(CMSOutputConnector conn,
                                    oracle.security.crypto.core.SymmetricKey contentEncryptionKey,
                                    oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID,
                                    oracle.security.crypto.asn1.ASN1ObjectID enclosedContentType)
                             throws oracle.security.crypto.core.AlgorithmIdentifierException,
                                    oracle.security.crypto.core.InvalidKeyException
Creates a CMSEncryptedDataOutputStream.
Parameters:
conn - The underlying output connector.
contentEncryptionKey - The content encryption key.
contentEncryptionAlgID - The content encryption algorithm.
enclosedContentType - The content type of the enclosed content.
Throws:
oracle.security.crypto.core.AlgorithmIdentifierException - The encryption algorithm is not supported.
oracle.security.crypto.core.InvalidKeyException - The encryption key is invalid.

CMSEncryptedDataOutputStream

public CMSEncryptedDataOutputStream(CMSOutputConnector conn,
                                    oracle.security.crypto.core.SymmetricKey contentEncryptionKey,
                                    oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID,
                                    oracle.security.crypto.asn1.ASN1ObjectID enclosedContentType,
                                    oracle.security.crypto.cert.AttributeSet unprotectedAttributes)
                             throws oracle.security.crypto.core.AlgorithmIdentifierException,
                                    oracle.security.crypto.core.InvalidKeyException
Creates a CMSEncryptedDataOutputStream.
Parameters:
conn - The underlying output connector.
contentEncryptionKey - The content encryption key.
contentEncryptionAlgID - The content encryption algorithm.
enclosedContentType - The content type of the enclosed content.
unprotectedAttributes - The set of unprotected attributes.
Throws:
oracle.security.crypto.core.AlgorithmIdentifierException - The encryption algorithm is not supported.
oracle.security.crypto.core.InvalidKeyException - The encryption key is invalid.

CMSEncryptedDataOutputStream

public CMSEncryptedDataOutputStream(CMSOutputConnector conn,
                                    oracle.security.crypto.core.SymmetricKey contentEncryptionKey,
                                    oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID,
                                    oracle.security.crypto.asn1.ASN1ObjectID enclosedContentType,
                                    oracle.security.crypto.cert.AttributeSet unprotectedAttributes,
                                    boolean writeEncryptedOutput)
                             throws oracle.security.crypto.core.AlgorithmIdentifierException,
                                    oracle.security.crypto.core.InvalidKeyException
Creates a CMSEncryptedDataOutputStream.
Parameters:
conn - The underlying output connector.
contentEncryptionKey - The content encryption key.
contentEncryptionAlgID - The content encryption algorithm.
enclosedContentType - The content type of the enclosed content.
unprotectedAttributes - The set of unprotected attributes.
writeEncryptedOutput - If true the encryptedContent will be written to the output stream; false otherwise.
Throws:
oracle.security.crypto.core.AlgorithmIdentifierException - The encryption algorithm is not supported.
oracle.security.crypto.core.InvalidKeyException - The encryption key is invalid.

Method Detail

terminate

public void terminate()
               throws java.io.IOException
Finish writing the encrypted-data structure to the underlying output stream.

Must be called only after all the enclosed data has been written to this output stream.

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

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 oracle.security.crypto.asn1.ASN1ObjectID getExposedContentType()
Returns the content type of the data that is 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 (10.1.4.0.1)

B28170-01


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