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

B15564-01


oracle.security.crypto.cms
Class CMSAuthenticatedDataInputStream

java.lang.Object
  extended byjava.io.InputStream
      extended byjava.io.FilterInputStream
          extended byoracle.security.crypto.cms.CMSInputStream
              extended byoracle.security.crypto.cms.CMSAuthenticatedDataInputStream


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, PrivateKey recipientPrivateKey, oracle.security.crypto.cert.X509 recipientCert)
Creates a CMSAuthenticatedDataInputStream.
CMSAuthenticatedDataInputStream(CMSInputConnector conn, SymmetricKey keyEncryptionKey)
Creates a CMSAuthenticatedDataInputStream.
CMSAuthenticatedDataInputStream(java.io.InputStream in, PrivateKey recipientPrivateKey, oracle.security.crypto.cert.X509 recipientCert)
Creates a CMSAuthenticatedDataInputStream.
CMSAuthenticatedDataInputStream(java.io.InputStream in, SymmetricKey keyEncryptionKey)
Creates a CMSAuthenticatedDataInputStream.

Method Summary
int available()
oracle.security.crypto.cert.AttributeSet getAuthenticatedAttributes()
Returns the set of Authenticated Attributes.
AlgorithmIdentifier getDigestAlgID()
Returns the Digest Algorithm.
ASN1ObjectID getEnclosedContentType()
Returns the content type of the authenticated data.
byte[] getMAC()
Returns the MAC.
AlgorithmIdentifier getMACAlgID()
Returns the MAC Algorithm.
OriginatorInfo getOriginatorInfo()
Returns the Originator Info.
oracle.security.crypto.cert.AttributeSet getUnauthenticatedAttributes()
Returns the set of Unauthenticated Attributes.
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,
                                       PrivateKey recipientPrivateKey,
                                       oracle.security.crypto.cert.X509 recipientCert)
Creates a CMSAuthenticatedDataInputStream.
Parameters:
in - The underlying input stream.
recipientPrivateKey - The recipient's private key.
recipientCert - The recipient's certificate.

CMSAuthenticatedDataInputStream

public CMSAuthenticatedDataInputStream(CMSInputConnector conn,
                                       PrivateKey recipientPrivateKey,
                                       oracle.security.crypto.cert.X509 recipientCert)
Creates a CMSAuthenticatedDataInputStream.
Parameters:
conn - The underlying input connector.
recipientPrivateKey - The recipient's private key.
recipientCert - The recipient's certificate.

CMSAuthenticatedDataInputStream

public CMSAuthenticatedDataInputStream(java.io.InputStream in,
                                       SymmetricKey keyEncryptionKey)
Creates a CMSAuthenticatedDataInputStream.
Parameters:
in - The underlying input stream.
keyEncryptionKey - The key used to encrypt the HMAC key.

CMSAuthenticatedDataInputStream

public CMSAuthenticatedDataInputStream(CMSInputConnector conn,
                                       SymmetricKey keyEncryptionKey)
Creates a CMSAuthenticatedDataInputStream.
Parameters:
conn - The underlying input connector.
keyEncryptionKey - The key used to encrypt the HMAC key.

Method Detail

getEnclosedContentType

public 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 AuthenticationException
Verify the Message Authentication Code.
Throws:
AuthenticationException - MAC verification failed.

read

public int read()
         throws java.io.IOException
Throws:
java.io.IOException

read

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

available

public int available()
              throws java.io.IOException
Throws:
java.io.IOException

skip

public long skip(long n)
          throws java.io.IOException
Not supported. Always throws an IOException.
Throws:
java.io.IOException

markSupported

public boolean markSupported()
Always returns false</false>.
Returns:
false

mark

public void mark(int readlimit)
Not supported.

reset

public void reset()
           throws java.io.IOException
Not supported.
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 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 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 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.

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

B15564-01


Copyright © 2005 , Oracle. All rights reserved.