Skip navigation links

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

E10667-02


oracle.security.crypto.cms
Class CMSAuthenticatedDataInputStream

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

All Implemented Interfaces:
java.io.Closeable

public class CMSAuthenticatedDataInputStream
extends CMSInputStream

A CMSAuthenticatedDataInputStream is used to read authenticated-data CMS objects.

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

You will be able to read a detached authenticated-data object using the CMSAuthenticatedDataInputStream class but you will not be able to verify the MAC.

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

See Also:
CMSInputConnector, CMSAuthenticatedDataInputConnector, CMSAuthenticatedDataContentInfo

Field Summary

 

Fields inherited from class java.io.FilterInputStream
in

 

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

 

Method Summary
 int available()
           
 oracle.security.crypto.cert.AttributeSet getAuthenticatedAttributes()
          Returns the set of Authenticated Attributes.
 oracle.security.crypto.core.AlgorithmIdentifier getDigestAlgID()
          Returns the Digest Algorithm.
 oracle.security.crypto.asn1.ASN1ObjectID getEnclosedContentType()
          Returns the content type of the authenticated data.
 byte[] getMAC()
          Returns the MAC.
 oracle.security.crypto.core.AlgorithmIdentifier getMACAlgID()
          Returns the MAC Algorithm.
 OriginatorInfo getOriginatorInfo()
          Returns the Originator Info.
 oracle.security.crypto.cert.AttributeSet getUnauthenticatedAttributes()
          Returns the set of Unauthenticated 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.
 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)
          Not supported.
 void terminate()
          Finish reading the authenticated-data structure.
 void verifyMAC()
          Verify the Message Authentication Code.

 

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

CMSAuthenticatedDataInputStream

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

Note the changes in the Method signature

Previouslypublic CMSAuthenticatedDataInputStream (InputStream, oracle.security.crypto.core.PrivateKey ,X509 )

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

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

Parameters:
in - The underlying input stream.
recipientPrivateKey - The recipient's private key.
recipientCert - The recipient's certificate.
Throws:
java.security.cert.CertificateEncodingException - Error while encoding the certificate
java.security.NoSuchAlgorithmException - Algorithm not supported
java.io.IOException - I/O exception while encoding the certificate

CMSAuthenticatedDataInputStream

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

Note the changes in the Method signature

Previouslypublic CMSAuthenticatedDataInputStream (CMSInputConnector ,oracle.security.crypto.core.PrivateKey , X509)

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

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

Parameters:
conn - The underlying input connector.
recipientPrivateKey - The recipient's private key.
recipientCert - The recipient's certificate.
Throws:
java.security.cert.CertificateEncodingException - Error while encoding the certificate
java.security.NoSuchAlgorithmException - Algorithm not supported
java.io.IOException - I/O exception while encoding the certificate

CMSAuthenticatedDataInputStream

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

Note the changes in the Method signature

Previouslypublic CMSAuthenticatedDataInputStream (InputStream , SymmetricKey )

Nowpublic CMSAuthenticatedDataInputStream (InputStream , SecretKey )

Parameters:
in - The underlying input stream.
keyEncryptionKey - The key used to encrypt the HMAC key.

CMSAuthenticatedDataInputStream

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

Note the changes in the Method signature

Previouslypublic CMSAuthenticatedDataInputStream (CMSInputConnector , SymmetricKey )

Nowpublic CMSAuthenticatedDataInputStream (CMSInputConnector , SecretKey )

Parameters:
conn - The underlying input connector.
keyEncryptionKey - The key used to encrypt the HMAC key.

Method Detail

getEnclosedContentType

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

verifyMAC

public void verifyMAC()
               throws oracle.security.crypto.core.AuthenticationException
Verify the Message Authentication Code.
Throws:
oracle.security.crypto.core.AuthenticationException - MAC verification failed.

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
Not supported. Always throws an 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

terminate

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

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

Specified by:
terminate in class CMSInputStream
Throws:
java.io.IOException - An I/O error occurred or unread authenticated data is present.

getOriginatorInfo

public OriginatorInfo getOriginatorInfo()
                                 throws java.io.IOException
Returns the Originator Info.
Returns:
The originator information if present or null otherwise.
Throws:
java.io.IOException - An I/O error occurred or the input encoding is incorrect.

getAuthenticatedAttributes

public oracle.security.crypto.cert.AttributeSet getAuthenticatedAttributes()
                                                                    throws java.io.IOException
Returns the set of Authenticated Attributes.
Returns:
The authenticated attributes if present or null otherwise.
Throws:
java.io.IOException - An I/O error occurred or the input encoding is incorrect.

getUnauthenticatedAttributes

public oracle.security.crypto.cert.AttributeSet getUnauthenticatedAttributes()
                                                                      throws java.io.IOException
Returns the set of Unauthenticated Attributes.
Returns:
The unauthenticated attributes if present or null otherwise.
Throws:
java.io.IOException - An I/O error occurred or the input encoding is incorrect.

getVersionNumber

public java.math.BigInteger getVersionNumber()
                                      throws java.io.IOException
Returns the version number.
Returns:
The version number as an ASN1Integer.
Throws:
java.io.IOException

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.
Throws:
java.io.IOException - An I/O error occurred or the input encoding is incorrect.

getMACAlgID

public oracle.security.crypto.core.AlgorithmIdentifier getMACAlgID()
                                                            throws java.io.IOException
Returns the MAC Algorithm.
Returns:
The message authentication algorithm identifier.
Throws:
java.io.IOException - An I/O error occurred or the input encoding is incorrect.

getDigestAlgID

public oracle.security.crypto.core.AlgorithmIdentifier getDigestAlgID()
                                                               throws java.io.IOException
Returns the Digest Algorithm.
Returns:
The digest algorithm identifier if present or null otherwise.
Throws:
java.io.IOException - An I/O error occurred or the input encoding is incorrect.

getMAC

public byte[] getMAC()
              throws java.io.IOException
Returns the MAC.
Returns:
The message authentication code.
Throws:
java.io.IOException - An I/O error occurred or the input encoding is incorrect.

Skip navigation links

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

E10667-02


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