Skip navigation links

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

E10667-02


oracle.security.crypto.cms
Class CMSDigestedDataOutputStream

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

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

public class CMSDigestedDataOutputStream
extends CMSOutputStream

A CMSDigestedDataOutputStream writes its output in the form of a CMS digested-data structure, generating the message digest 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 digested-data Objects more efficiently (Java VM memory usage) than the CMSDigestedDataContentInfo class.

See Also:
CMSOutputStream, CMSDigestedDataContentInfo, CMSDigestedDataOutputConnector

Field Summary

 

Fields inherited from class java.io.FilterOutputStream
out

 

Constructor Summary
CMSDigestedDataOutputStream(CMSOutputConnector conn, oracle.security.crypto.core.AlgorithmIdentifier digestAlgID, oracle.security.crypto.asn1.ASN1ObjectID contentType)
          Creates a CMSDigestedDataOutputStream.
CMSDigestedDataOutputStream(CMSOutputConnector conn, oracle.security.crypto.core.AlgorithmIdentifier digestAlgID, oracle.security.crypto.asn1.ASN1ObjectID contentType, boolean writeEContentInfo)
          Creates a CMSDigestedDataOutputStream.
CMSDigestedDataOutputStream(java.io.OutputStream out, oracle.security.crypto.core.AlgorithmIdentifier digestAlgID, oracle.security.crypto.asn1.ASN1ObjectID contentType)
          Creates a CMSDigestedDataOutputStream.
CMSDigestedDataOutputStream(java.io.OutputStream out, oracle.security.crypto.core.AlgorithmIdentifier digestAlgID, oracle.security.crypto.asn1.ASN1ObjectID contentType, boolean writeEContentInfo)
          Creates a CMSDigestedDataOutputStream.

 

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 CMS digested-data structure.
 void write(byte[] b, int off, 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

CMSDigestedDataOutputStream

public CMSDigestedDataOutputStream(java.io.OutputStream out,
                                   oracle.security.crypto.core.AlgorithmIdentifier digestAlgID,
                                   oracle.security.crypto.asn1.ASN1ObjectID contentType)
                            throws java.security.NoSuchAlgorithmException
Creates a CMSDigestedDataOutputStream.

Note the changes in the exceptions

Exceptions no longer thrown -- AlgorithmIdentifierException

Exceptions introduced -- NoSuchAlgorthmException

Parameters:
out - The underlying output stream.
digestAlgID - The message digest algorithm.
contentType - The encapsulated content type.
Throws:
java.security.NoSuchAlgorithmException - Digest algorithm is not supported.

CMSDigestedDataOutputStream

public CMSDigestedDataOutputStream(java.io.OutputStream out,
                                   oracle.security.crypto.core.AlgorithmIdentifier digestAlgID,
                                   oracle.security.crypto.asn1.ASN1ObjectID contentType,
                                   boolean writeEContentInfo)
                            throws java.security.NoSuchAlgorithmException
Creates a CMSDigestedDataOutputStream.

Note the changes in the exceptions

Exceptions no longer thrown -- AlgorithmIdentifierException

Exceptions introduced -- NoSuchAlgorthmException

Parameters:
out - The underlying output stream.
digestAlgID - The message digest algorithm.
contentType - The encapsulated content type.
writeEContentInfo - true if the encapsulated content is to be written to the underlying output stream; false otherwise.
Throws:
java.security.NoSuchAlgorithmException - Digest algorithm is not supported.

CMSDigestedDataOutputStream

public CMSDigestedDataOutputStream(CMSOutputConnector conn,
                                   oracle.security.crypto.core.AlgorithmIdentifier digestAlgID,
                                   oracle.security.crypto.asn1.ASN1ObjectID contentType)
                            throws java.security.NoSuchAlgorithmException
Creates a CMSDigestedDataOutputStream.

Note the changes in the exceptions

Exceptions no longer thrown -- AlgorithmIdentifierException

Exceptions introduced -- NoSuchAlgorthmException

Parameters:
conn - The underlying output connector.
digestAlgID - The message digest algorithm.
contentType - The encapsulated content type.
Throws:
java.security.NoSuchAlgorithmException - Digest algorithm is not supported.

CMSDigestedDataOutputStream

public CMSDigestedDataOutputStream(CMSOutputConnector conn,
                                   oracle.security.crypto.core.AlgorithmIdentifier digestAlgID,
                                   oracle.security.crypto.asn1.ASN1ObjectID contentType,
                                   boolean writeEContentInfo)
                            throws java.security.NoSuchAlgorithmException
Creates a CMSDigestedDataOutputStream.

Note the changes in the exceptions

Exceptions no longer thrown -- AlgorithmIdentifierException

Exceptions introduced -- NoSuchAlgorthmException

Parameters:
conn - The underlying output connector.
digestAlgID - The message digest algorithm.
contentType - The encapsulated content type.
writeEContentInfo - true if the encapsulated content is to be written to the underlying output stream; false otherwise.
Throws:
java.security.NoSuchAlgorithmException - Digest algorithm is not supported.

Method Detail

terminate

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

This method must be called after the content has been completely written.

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
Overrides:
write in class java.io.FilterOutputStream
Throws:
java.io.IOException

write

public void write(byte[] b,
                  int off,
                  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 that is 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.