Skip navigation links

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

E10667-02


oracle.security.crypto.cms
Class CMSContentInfo

java.lang.Object
  extended by oracle.security.crypto.cms.CMSContentInfo

All Implemented Interfaces:
oracle.security.crypto.asn1.ASN1Object, oracle.security.crypto.util.Streamable
Direct Known Subclasses:
CMSAuthenticatedDataContentInfo, CMSCompressedDataContentInfo, CMSDataContentInfo, CMSDigestedDataContentInfo, CMSEncryptedDataContentInfo, CMSEnvelopedDataContentInfo, CMSSignedDataContentInfo, ESSReceipt, TSTInfo

public abstract class CMSContentInfo
extends java.lang.Object
implements oracle.security.crypto.asn1.ASN1Object

The base class for all CMS objects.

A CMS object consists of a content type, and content.

Subclasses must override the getExposedContent and inputContent methods.


Constructor Summary
protected CMSContentInfo(oracle.security.crypto.asn1.ASN1ObjectID contentType)
          Creates a CMSContentInfo object with the specified content type.

 

Method Summary
 byte[] computeDigest(java.security.MessageDigest md)
          Computes the Message Digest of the exposed content.
static java.lang.String contentTypeName(oracle.security.crypto.asn1.ASN1ObjectID contentType)
          Returns the content type of the CMS Object.
 oracle.security.crypto.asn1.ASN1ObjectID getContentType()
          Returns the content type of the CMS object.
protected abstract  byte[] getExposedContent()
          Returns the contents octets of the DER encoding of the content field of this CMS object.
 void input(java.io.InputStream is)
          Initialize this CMS Object by reading a BER encoding from the specified input stream.
protected abstract  void inputContent(java.io.InputStream is)
          Initializes this object by reading the Content field of the CMS ContentInfo structure i.e.
static CMSContentInfo inputInstance(java.io.InputStream is)
          Creates a CMSContentInfo object by reading a BER encoding from the given input stream.
 boolean isDegenerate()
          Returns false, except as noted below.
abstract  boolean isDetached()
          This method must be implemented by the subclasses.
 int length()
          Returns the length of this object's encoding.
 void output(java.io.OutputStream os)
          Outputs this object to the specified output stream.
protected abstract  void setExposedContent(byte[] expContent)
          Returns the contents octets of the DER encoding of the content field of this CMS object.
protected  void update()
          Clears the internal output cache.

 

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

 

Constructor Detail

CMSContentInfo

protected CMSContentInfo(oracle.security.crypto.asn1.ASN1ObjectID contentType)
Creates a CMSContentInfo object with the specified content type.
Parameters:
contentType - The content type of the object.
See Also:
CMS

Method Detail

inputInstance

public static CMSContentInfo inputInstance(java.io.InputStream is)
                                    throws java.io.IOException
Creates a CMSContentInfo object by reading a BER encoding from the given input stream.

This method is typically used to read nested CMS Objects instead of using the CMSInputStream classes.

Parameters:
is - The input stream containing an encoded CMS Object.
Returns:
CMSContentInfo The CMS object.
Throws:
java.io.IOException - If an I/O error occurred or the CMS object encoding was incorrect or the CMS object content type is not supported.
See Also:
CMSInputStream

getContentType

public oracle.security.crypto.asn1.ASN1ObjectID getContentType()
Returns the content type of the CMS object.
Returns:
The content type identifier.
See Also:
CMS

getExposedContent

protected abstract byte[] getExposedContent()
Returns the contents octets of the DER encoding of the content field of this CMS object. The value returned is suitable for input to the "message-digesting" and "content-encryption" process of RFC-2630.
Returns:
The contents octets or null for a detached CMS object.
See Also:
isDetached()

contentTypeName

public static java.lang.String contentTypeName(oracle.security.crypto.asn1.ASN1ObjectID contentType)
Returns the content type of the CMS Object.
Returns:
The content type string.

isDegenerate

public boolean isDegenerate()
Returns false, except as noted below.

CMS (RFC-2630) defines a degenerate case only for the CMSSignedDataContentInfo i.e. signed-data, so this method is overridden to return true when appropriate.


isDetached

public abstract boolean isDetached()
This method must be implemented by the subclasses.

A detached object is defined as one in which the protected content is not present.

In the case of CMSDigestedDataContentInfo, CMSSignedDataContentInfo and CMSAuthenticatedDataContentInfo the econtent is missing in the EncapsulatedContentInfo structure. In the case of CMSEncryptedDataContentInfo and CMSEnvelopedDataContentInfo the encryptedContent is missing in the EncryptedContentInfo structure.

NOTE: This method only indicates the presence of protected content. There is no way to distinguish between missing content and empty protected content.

Returns:
<true>if the protected content is missing</true>; <false>otherwise</false>.

setExposedContent

protected abstract void setExposedContent(byte[] expContent)
Returns the contents octets of the DER encoding of the content field of this CMS object. The value returned is suitable for input to the "message-digesting" and "content-encryption" process of RFC-2630.
See Also:
isDetached()

computeDigest

public byte[] computeDigest(java.security.MessageDigest md)
Computes the Message Digest of the exposed content.

Note the changes in the Method signature

Previously public byte[] computeDigest (oracle.security.crypto.core.MessageDigest md)

Now public byte[] computeDigest (java.security.MessageDigest md)

Parameters:
md - The message digest.
Returns:
The digest of the exposed content.
See Also:
getExposedContent()

input

public void input(java.io.InputStream is)
           throws java.io.IOException
Initialize this CMS Object by reading a BER encoding from the specified input stream.
Specified by:
input in interface oracle.security.crypto.util.Streamable
Parameters:
is - The input stream containing CMS Objects.
Throws:
java.io.IOException - An I/O error occurred or the CMS Object encoding was incorrect or the CMS Object content type is not supported.

inputContent

protected abstract void inputContent(java.io.InputStream is)
                              throws java.io.IOException
Initializes this object by reading the Content field of the CMS ContentInfo structure i.e. the input stream must be positioned at the value octets of the Content field i.e. after the explicit [0] tag.

This method must be implemented by subclasses. It is unlikely that package users will ever need to call it directly.

Throws:
java.io.IOException

output

public void output(java.io.OutputStream os)
            throws java.io.IOException
Outputs this object to the specified output stream.

You must ensure that the CMSContentInfo object has been properly initialized.

Specified by:
output in interface oracle.security.crypto.util.Streamable
Throws:
java.io.IOException - If the content is null or an I/O error occurs.

length

public int length()
Returns the length of this object's encoding.
Specified by:
length in interface oracle.security.crypto.util.Streamable
Returns:
The length in bytes.

update

protected void update()
Clears the internal output cache. This method is called automatically if the object ever changes, so API users need not be concerned with it. Implementors of subclasses, however, do need to ensure that it gets called when appropriate (unless the subclass implements its own output method).

Skip navigation links

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

E10667-02


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