Skip navigation links

Oracle Fusion Middleware CMS Java API Reference for Oracle Security Developer Tools
11g Release 1 (11.1.1)

E10667-04


oracle.security.crypto.cms
Class CMSEnvelopedDataInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by oracle.security.crypto.cms.CMSInputStream
              extended by oracle.security.crypto.cms.CMSEnvelopedDataInputStream

All Implemented Interfaces:
java.io.Closeable

public class CMSEnvelopedDataInputStream
extends CMSInputStream

A CMSEnvelopedDataInputStream is used to read enveloped-data CMS objects.

A CMSEnvelopedDataInputStream is essentially a input stream filter that unwraps the CMS enveloped-data structure from the data read in.

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

See Also:
CMSInputConnector, CMSEnvelopedDataInputConnector, CMSEnvelopedDataContentInfo

Field Summary

 

Fields inherited from class java.io.FilterInputStream
in

 

Constructor Summary
CMSEnvelopedDataInputStream(CMSInputConnector conn, java.security.PrivateKey recipientPrivateKey, java.security.cert.X509Certificate recipientCert)
          Creates a CMSEnvelopedDataInputStream.
CMSEnvelopedDataInputStream(CMSInputConnector conn, javax.crypto.SecretKey keyEncryptionKey)
          Creates a CMSEnvelopedDataInputStream.
CMSEnvelopedDataInputStream(java.io.InputStream in, java.security.PrivateKey recipientPrivateKey, java.security.cert.X509Certificate recipientCert)
          Creates a CMSEnvelopedDataInputStream.
CMSEnvelopedDataInputStream(java.io.InputStream in, javax.crypto.SecretKey keyEncryptionKey)
          Creates a CMSEnvelopedDataInputStream.

 

Method Summary
 int available()
           
 oracle.security.crypto.core.AlgorithmIdentifier getContentEncryptionAlgID()
          Returns the content encryption algorithm.
 oracle.security.crypto.asn1.ASN1ObjectID getEnclosedContentType()
          Returns the content type of the encrypted content.
 OriginatorInfo getOrginatorInfo()
          Returns the OriginatorInfo.
 oracle.security.crypto.cert.AttributeSet getUnprotectedAttribs()
          Returns the unprotected attributes.
 oracle.security.crypto.asn1.ASN1Integer getVersion()
          Deprecated. As of Phaos CMS 2.0.1, replaced by getVersionNumber()
 java.math.BigInteger getVersionNumber()
          Returns the version number of this CMS Object.
 void mark(int readlimit)
          Not supported.
 boolean markSupported()
          Always returns false</false>.
 int read()
           
 int read(byte[] buffer, int offset, int len)
           
 void reset()
          Not supported.
 long skip(long n)
           
 void terminate()
          Finish reading the enveloped-data structure.

 

Methods inherited from class java.io.FilterInputStream
close, read

 

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

 

Constructor Detail

CMSEnvelopedDataInputStream

public CMSEnvelopedDataInputStream(java.io.InputStream in,
                                   java.security.PrivateKey recipientPrivateKey,
                                   java.security.cert.X509Certificate recipientCert)
                            throws java.security.NoSuchAlgorithmException,
                                   java.security.cert.CertificateEncodingException,
                                   java.io.IOException
Creates a CMSEnvelopedDataInputStream.

Note the changes in the Method signature

Previously public CMSEnvelopedDataInputStream (InputStream , oracle.security.crypto.core.PrivateKey , X509 )

Nowpublic CMSEnvelopedDataInputStream (InputStream , java.security.PrivateKey , X509Certificate )

Note the changes in exceptions Exceptions introduced -- IOException,CertificateEncodingException,NoSuchAlgorithmException

Parameters:
in - The underlying input stream.
recipientPrivateKey - The private key of the recipient.
recipientCert - The recipient's certificate.
Throws:
java.security.NoSuchAlgorithmException - Algorithm Not supported
java.security.cert.CertificateEncodingException - Specifies an encoding error
java.io.IOException - Input/Output Exception while instantiating X509 from an inputstream

CMSEnvelopedDataInputStream

public CMSEnvelopedDataInputStream(CMSInputConnector conn,
                                   java.security.PrivateKey recipientPrivateKey,
                                   java.security.cert.X509Certificate recipientCert)
                            throws java.io.IOException,
                                   java.security.NoSuchAlgorithmException,
                                   java.security.cert.CertificateEncodingException
Creates a CMSEnvelopedDataInputStream.

Note the changes in the Method signature

Previously public CMSEnvelopedDataInputStream (CMSInputConnector , oracle.security.crypto.core.PrivateKey , X509 )

Nowpublic CMSEnvelopedDataInputStream (CMSInputConnector , java.security.PrivateKey , X509Certificate )

Note the changes in exceptions Exceptions introduced -- IOException,CertificateEncodingException,NoSuchAlgorithmException

Parameters:
conn - The underlying input connector.
recipientPrivateKey - The private key of the recipient.
recipientCert - The recipient's certificate.
Throws:
java.security.NoSuchAlgorithmException - Algorithm Not supported
java.security.cert.CertificateEncodingException - Specifies an encoding error
java.io.IOException - Input/Output Exception while instantiating X509 from an inputstream

CMSEnvelopedDataInputStream

public CMSEnvelopedDataInputStream(java.io.InputStream in,
                                   javax.crypto.SecretKey keyEncryptionKey)
Creates a CMSEnvelopedDataInputStream.

Note the changes in the Method signature

Previously public CMSEnvelopedDataInputStream (InputStream, SymmetricKey )

Nowpublic CMSEnvelopedDataInputStream (InputStream, SecretKey )

Parameters:
in - The underlying input stream.
keyEncryptionKey - The key used for key encipherment.

CMSEnvelopedDataInputStream

public CMSEnvelopedDataInputStream(CMSInputConnector conn,
                                   javax.crypto.SecretKey keyEncryptionKey)
Creates a CMSEnvelopedDataInputStream.

Note the changes in the Method signature

Previously public CMSEnvelopedDataInputStream (CMSInputConnector, SymmetricKey )

Nowpublic CMSEnvelopedDataInputStream (CMSInputConnector, SecretKey )

Parameters:
in - The underlying input connector.
keyEncryptionKey - The key used for key encipherment.

Method Detail

terminate

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

This method must be called only after all the enclosed data has been read.

Specified by:
terminate in class CMSInputStream
Throws:
java.io.IOException - If the encoding is incorrect or an I/O error occurs.

read

public int read()
         throws java.io.IOException
Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException

read

public int read(byte[] buffer,
                int offset,
                int len)
         throws java.io.IOException
Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException

available

public int available()
              throws java.io.IOException
Overrides:
available in class java.io.FilterInputStream
Throws:
java.io.IOException

skip

public long skip(long n)
          throws java.io.IOException
Overrides:
skip in class java.io.FilterInputStream
Throws:
java.io.IOException

markSupported

public boolean markSupported()
Always returns false</false>.
Overrides:
markSupported in class java.io.FilterInputStream
Returns:
false

mark

public void mark(int readlimit)
Not supported.
Overrides:
mark in class java.io.FilterInputStream

reset

public void reset()
           throws java.io.IOException
Not supported.
Overrides:
reset in class java.io.FilterInputStream
Throws:
java.io.IOException - always

getVersionNumber

public java.math.BigInteger getVersionNumber()
                                      throws java.io.IOException
Returns the version number of this CMS Object.
Returns:
The version number as an ASN1Integer.
Throws:
java.io.IOException - An I/O error occurred or the input is incorrectly encoded.

getVersion

public oracle.security.crypto.asn1.ASN1Integer getVersion()
                                                   throws java.io.IOException
Deprecated. As of Phaos CMS 2.0.1, replaced by getVersionNumber()
Returns the version number of this CMS Object.
Returns:
The version number.
Throws:
java.io.IOException - If the encoding is incorrect or an I/O error occurs.

getOrginatorInfo

public OriginatorInfo getOrginatorInfo()
                                throws java.io.IOException
Returns the OriginatorInfo.
Returns:
The OriginatorInfo.
Throws:
java.io.IOException - If the encoding is incorrect or an I/O error occurs.

getUnprotectedAttribs

public oracle.security.crypto.cert.AttributeSet getUnprotectedAttribs()
                                                               throws java.io.IOException
Returns the unprotected attributes.
Returns:
The unprotected attributes.
Throws:
java.io.IOException - If the encoding is incorrect or an I/O error occurs.

getEnclosedContentType

public oracle.security.crypto.asn1.ASN1ObjectID getEnclosedContentType()
                                                                throws java.io.IOException
Returns the content type of the encrypted content.
Specified by:
getEnclosedContentType in class CMSInputStream
Returns:
The content type object identifier.
Throws:
java.io.IOException - If the encoding is incorrect or an I/O error occurs.

getContentEncryptionAlgID

public oracle.security.crypto.core.AlgorithmIdentifier getContentEncryptionAlgID()
                                                                          throws java.io.IOException
Returns the content encryption algorithm.
Returns:
The encryption algorithm identifier.
Throws:
java.io.IOException - If the encoding is incorrect or an I/O error occurs.

Skip navigation links

Oracle Fusion Middleware CMS Java API Reference for Oracle Security Developer Tools
11g Release 1 (11.1.1)

E10667-04


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