Skip navigation links

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

E10667-02


oracle.security.crypto.cms
Class CMSSignedDataInputStream

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

All Implemented Interfaces:
java.io.Closeable

public class CMSSignedDataInputStream
extends CMSInputStream

A CMSSignedDataInputStream is used to read signed-data CMS objects.

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

You will be able to read a detached signed-data object using the CMSSignedDataInputStream class but you will not be able to verify the signature.

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

See Also:
CMSInputConnector, CMSSignedDataInputConnector, CMSSignedDataContentInfo

Field Summary

 

Fields inherited from class java.io.FilterInputStream
in

 

Constructor Summary
CMSSignedDataInputStream(CMSInputConnector conn)
          Creates a CMSSignedDataInputStream.
CMSSignedDataInputStream(java.io.InputStream in)
          Creates a CMSSignedDataInputStream.

 

Method Summary
 int available()
           
 java.util.Vector getCertificates()
          Returns the list of certificates included with this signed data object.
 java.util.Vector getCRLs()
          Returns the list of CRLs included with this signed data object.
 java.util.Enumeration getDigestAlgIDs()
          Returns the list of Digest Algorithms.
 oracle.security.crypto.asn1.ASN1ObjectID getEnclosedContentType()
          Returns the content type of the signed content.
 CMSSignerInfo getSignerInfo(java.security.cert.X509Certificate signerCert)
          Return the SignerInfo corresponding to the signer certificate.
 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()
          Not Supported.
 int read()
           
 int read(byte[] buffer, int offset, int len)
           
 void reset()
          Not supported.
 java.util.Enumeration signers()
          Returns the enumeration of message signers.
 long skip(long n)
          Not supported.
 void terminate()
          Ensures that the CMS Object in the input stream has been completely read.
 void verifySignature(java.security.cert.X509Certificate signerCert)
          Verify the Signature.

 

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

CMSSignedDataInputStream

public CMSSignedDataInputStream(java.io.InputStream in)
Creates a CMSSignedDataInputStream.
Parameters:
in - The underlying input stream.

CMSSignedDataInputStream

public CMSSignedDataInputStream(CMSInputConnector conn)
Creates a CMSSignedDataInputStream.
Parameters:
conn - The underlying input connector.

Method Detail

getEnclosedContentType

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

signers

public java.util.Enumeration signers()
                              throws java.io.IOException
Returns the enumeration of message signers.
Returns:
The enumeration containing CMSSignerInfo objects.
Throws:
java.io.IOException - An I/O error occurred or the input is incorrectly encoded.

getCertificates

public java.util.Vector getCertificates()
                                 throws java.io.IOException
Returns the list of certificates included with this signed data object.
Returns:
Vector containing X509 objects or null if no list of certificates is present.
Throws:
java.io.IOException - An I/O error occurred or the input is incorrectly encoded.

getCRLs

public java.util.Vector getCRLs()
                         throws java.io.IOException
Returns the list of CRLs included with this signed data object.
Returns:
Vector containing CRL objects or null if no list of CRLs is present.
Throws:
java.io.IOException - An I/O error occurred or the input is incorrectly encoded.

getSignerInfo

public CMSSignerInfo getSignerInfo(java.security.cert.X509Certificate signerCert)
                            throws UnknownSignerException,
                                   java.io.IOException,
                                   java.security.cert.CertificateEncodingException,
                                   java.security.NoSuchAlgorithmException
Return the SignerInfo corresponding to the signer certificate.

Note the changes in the Method signature

Previouslypublic CMSSignerInfo getSignerInfo (X509)

Now public CMSSignerInfo getSignerInfo (X509Certificate)

Exceptions included -- NoSuchAlgorithmException ,CertificateEncodingException, IOException

Parameters:
signerCert - The signer certificate.
Returns:
CMSSignerInfo object.
Throws:
UnknownSignerException - No SignerInfo matching the specified certificate.
java.io.IOException - IO error when creating a certificate from the input stream
java.security.cert.CertificateEncodingException - Error while encoding the certificate
java.security.NoSuchAlgorithmException - Algorithm not supported

verifySignature

public void verifySignature(java.security.cert.X509Certificate signerCert)
                     throws oracle.security.crypto.core.AuthenticationException,
                            UnknownSignerException
Verify the Signature.

Note the changes in the Method signature

Previouslypublic void verifySignature (X509 )

Nowpublic void verifySignature (X509Certificate )

Parameters:
signerCert - The signing certificate.
Throws:
oracle.security.crypto.core.AuthenticationException - Signature is not valid.
UnknownSignerException - Could not find the matching SignerInfo.

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()
Not Supported.
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 (not supported).

terminate

public void terminate()
               throws java.io.IOException
Description copied from class: CMSInputStream
Ensures that the CMS Object in the input stream has been completely read.

Must be called after all the content enclosed by the CMS Object has been read.

Specified by:
terminate in class CMSInputStream
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 of this CMS Object.
Returns:
The version number.
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 - An I/O error occurred or the input encoding is incorrect.

getDigestAlgIDs

public java.util.Enumeration getDigestAlgIDs()
                                      throws java.io.IOException
Returns the list of Digest Algorithms.
Returns:
An enumeration of digest algorithm identifiers.
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.