Skip navigation links

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

E10667-02


oracle.security.crypto.cms
Class CMSEncryptedDataContentInfo

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

All Implemented Interfaces:
oracle.security.crypto.asn1.ASN1Object, oracle.security.crypto.util.Streamable

public class CMSEncryptedDataContentInfo
extends CMSContentInfo

This class encapsulates a CMS object of content type encrypted-data.


Constructor Summary
CMSEncryptedDataContentInfo()
          Creates an empty CMSEncryptedDataContentInfo.
CMSEncryptedDataContentInfo(CMSContentInfo contentInfo, javax.crypto.SecretKey contentEncryptionKey, oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID)
          Creates a CMSEncryptedDataContentInfo.
CMSEncryptedDataContentInfo(CMSContentInfo contentInfo, javax.crypto.SecretKey contentEncryptionKey, oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID, oracle.security.crypto.cert.AttributeSet unprotectedAttributes)
          Creates a CMSEncryptedDataContentInfo.
CMSEncryptedDataContentInfo(java.io.InputStream is)
          Creates a CMSEncryptedDataContentInfo CMS object, by reading a BER encoding from the specified input stream.

 

Method Summary
 boolean equals(java.lang.Object obj)
          Indicates whether some other object is "equal to" this one.
 oracle.security.crypto.core.AlgorithmIdentifier getContentEncryptionAlgID()
          Returns the content encryption algorithm.
 CMSContentInfo getEnclosed(javax.crypto.SecretKey decryptionKey)
          Returns the decrypted content.
 oracle.security.crypto.asn1.ASN1ObjectID getEnclosedContentType()
          Returns the content type of the Encrypted Content.
 byte[] getEncryptedContent()
          Returns the encrypted content.
protected  byte[] getExposedContent()
          Returns the contents octets of the DER encoding of the content field of this CMS object.
 oracle.security.crypto.cert.AttributeSet getUnprotectedAttributes()
          Returns the Set of 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.
 int hashCode()
          Returns a hash code value for this object.
protected  void inputContent(java.io.InputStream is)
          Initializes this object by reading the Content field of the CMS ContentInfo structure i.e.
 boolean isDetached()
          Indicate if this is a detached CMS object.
 void setEnclosed(byte[] encryptedContent)
          Sets the encrypted content.
protected  void setExposedContent(byte[] expContent)
          Returns the contents octets of the DER encoding of the content field of this CMS object.
 void setUnprotectedAttributes(oracle.security.crypto.cert.AttributeSet unprotectedAttributes)
          Sets the Unprotected Attributes.
 java.lang.String toString()
          Returns a brief text description of this object.
protected  void update()
          Clears the internal output cache.
 void writeDetached(boolean writeDetachedObject)
          Indicate if the encryptedContent will be a part of the EncryptedContentInfo structure in this object's output encoding.

 

Methods inherited from class oracle.security.crypto.cms.CMSContentInfo
computeDigest, contentTypeName, getContentType, input, inputInstance, isDegenerate, length, output

 

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

 

Constructor Detail

CMSEncryptedDataContentInfo

public CMSEncryptedDataContentInfo()
Creates an empty CMSEncryptedDataContentInfo.

CMSEncryptedDataContentInfo

public CMSEncryptedDataContentInfo(CMSContentInfo contentInfo,
                                   javax.crypto.SecretKey contentEncryptionKey,
                                   oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID)
                            throws java.security.NoSuchAlgorithmException,
                                   java.security.InvalidKeyException,
                                   javax.crypto.NoSuchPaddingException,
                                   javax.crypto.IllegalBlockSizeException,
                                   javax.crypto.BadPaddingException
Creates a CMSEncryptedDataContentInfo.

Note the changes in the Method signature

Previouslypublic CMSEncryptedDataContentInfo (CMSContentInfo , SymmetricKey, AlgorithmIdentifier )

Nowpublic CMSEncryptedDataContentInfo (CMSContentInfo , SecretKey, AlgorithmIdentifier )

Note the changes in exceptions Exceptions no longer thrown -- AlgorithmIdentifierException , CipherException Exceptions included -- NoSuchAlgorithmException, NoSuchPaddingException,IllegalBlockSizeException, BadPaddingException

Parameters:
contentInfo - The CMS Object to encrypt.
contentEncryptionKey - The content encryption key.
contentEncryptionAlgID - The content encryption algorithm.
Throws:
java.security.NoSuchAlgorithmException - The encryption algorithm is not supported.
java.security.InvalidKeyException - The content encryption key is invalid.
javax.crypto.NoSuchPaddingException - The padding mechanism not supported
javax.crypto.BadPaddingException - The required padding not found
javax.crypto.IllegalBlockSizeException - Block size is invalide (Cipher)

CMSEncryptedDataContentInfo

public CMSEncryptedDataContentInfo(CMSContentInfo contentInfo,
                                   javax.crypto.SecretKey contentEncryptionKey,
                                   oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID,
                                   oracle.security.crypto.cert.AttributeSet unprotectedAttributes)
                            throws java.security.NoSuchAlgorithmException,
                                   java.security.InvalidKeyException,
                                   javax.crypto.NoSuchPaddingException,
                                   javax.crypto.IllegalBlockSizeException,
                                   javax.crypto.BadPaddingException
Creates a CMSEncryptedDataContentInfo.

Note the changes in the Method signature

Previouslypublic CMSEncryptedDataContentInfo (CMSContentInfo , SymmetricKey , AlgorithmIdentifier ,AttributeSet )

Nowpublic CMSEncryptedDataContentInfo (CMSContentInfo , SecretKey , AlgorithmIdentifier ,AttributeSet )

Note the changes in exceptions Exceptions no longer thrown -- AlgorithmIdentifierException , CipherException Exceptions included -- NoSuchAlgorithmException, NoSuchPaddingException,IllegalBlockSizeException, BadPaddingException

Parameters:
contentInfo - The CMS Object to encrypt.
contentEncryptionKey - The content encryption key.
contentEncryptionAlgID - The content encryption algorithm.
unprotectedAttributes - The set of unprotected attributes.
Throws:
java.security.NoSuchAlgorithmException - The encryption algorithm is not supported.
java.security.InvalidKeyException - The content encryption key is invalid.
javax.crypto.NoSuchPaddingException - The padding mechanism not supported
javax.crypto.BadPaddingException - The required padding not found
javax.crypto.IllegalBlockSizeException - Block size is invalide (Cipher)

CMSEncryptedDataContentInfo

public CMSEncryptedDataContentInfo(java.io.InputStream is)
                            throws java.io.IOException
Creates a CMSEncryptedDataContentInfo CMS object, by reading a BER encoding from the specified input stream.
Parameters:
is - The input stream.
Throws:
java.io.IOException - If the input is not correctly formatted or an I/O error occurred or the input content type is not supported.

Method Detail

writeDetached

public void writeDetached(boolean writeDetachedObject)
Indicate if the encryptedContent will be a part of the EncryptedContentInfo structure in this object's output encoding.
Parameters:
writeDetachedObject - If true the encryptedContent will be omitted; false otherwise.

isDetached

public boolean isDetached()
Indicate if this is a detached CMS object.
Specified by:
isDetached in class CMSContentInfo
Returns:
true if the encrypted content is not present; false otherwise.
See Also:
CMSContentInfo.isDetached()

setExposedContent

protected void setExposedContent(byte[] expContent)
Description copied from class: CMSContentInfo
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.
Specified by:
setExposedContent in class CMSContentInfo
See Also:
CMSContentInfo.isDetached()

getExposedContent

protected byte[] getExposedContent()
Description copied from class: CMSContentInfo
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.
Specified by:
getExposedContent in class CMSContentInfo
Returns:
The contents octets or null for a detached CMS object.
See Also:
CMSContentInfo.isDetached()

getEnclosedContentType

public oracle.security.crypto.asn1.ASN1ObjectID getEnclosedContentType()
Returns the content type of the Encrypted Content.
Returns:
The content type identifier.

getContentEncryptionAlgID

public oracle.security.crypto.core.AlgorithmIdentifier getContentEncryptionAlgID()
Returns the content encryption algorithm.
Returns:
The encryption algorithm identifier.

getEncryptedContent

public byte[] getEncryptedContent()
Returns the encrypted content.
Returns:
The encrypted content.

getVersionNumber

public java.math.BigInteger getVersionNumber()
Returns the version number.
Returns:
The version number.

getVersion

public oracle.security.crypto.asn1.ASN1Integer getVersion()
Deprecated. As of Phaos CMS 2.0.1, replaced by getVersionNumber()
Returns the version number.
Returns:
The version number.

getUnprotectedAttributes

public oracle.security.crypto.cert.AttributeSet getUnprotectedAttributes()
Returns the Set of Unprotected Attributes.
Returns:
The unprotected attributes if present or null otherwise.

setUnprotectedAttributes

public void setUnprotectedAttributes(oracle.security.crypto.cert.AttributeSet unprotectedAttributes)
Sets the Unprotected Attributes.
Parameters:
unprotectedAttributes - The unprotected attributes.

toString

public java.lang.String toString()
Returns a brief text description of this object.
Overrides:
toString in class java.lang.Object
Returns:
A string description of this object.

hashCode

public int hashCode()
Returns a hash code value for this object.
Overrides:
hashCode in class java.lang.Object
Returns:
The hash code value.

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.
Overrides:
equals in class java.lang.Object
Returns:
true if this object is the same as the obj argument; false otherwise.

setEnclosed

public void setEnclosed(byte[] encryptedContent)
Sets the encrypted content.
Parameters:
encryptedContent - The encrypted content.

getEnclosed

public CMSContentInfo getEnclosed(javax.crypto.SecretKey decryptionKey)
                           throws java.security.NoSuchAlgorithmException,
                                  java.security.InvalidKeyException,
                                  oracle.security.crypto.util.InvalidInputException,
                                  javax.crypto.BadPaddingException,
                                  javax.crypto.IllegalBlockSizeException,
                                  javax.crypto.NoSuchPaddingException
Returns the decrypted content. Creates a CMSEncryptedDataContentInfo.

Note the changes in the Method signature

Previouslypublic CMSContentInfo getEnclosed (SymmetricKey decryptionKey)

Nowpublic CMSContentInfo getEnclosed (SecretKey decryptionKey)

Note the changes in exceptions Exceptions no longer thrown -- AlgorithmIdentifierException , CipherException Exceptions included -- NoSuchAlgorithmException, NoSuchPaddingException,IllegalBlockSizeException, BadPaddingException

Parameters:
decryptionKey - The decryption key.
Returns:
The decrypted content.
Throws:
oracle.security.crypto.util.InvalidInputException - The content is incorrectly encoded or an I/O error occurred.
java.security.NoSuchAlgorithmException - The encryption algorithm is not supported.
java.security.InvalidKeyException - The content encryption key is invalid.
javax.crypto.NoSuchPaddingException - The padding mechanism not supported
javax.crypto.BadPaddingException - The required padding not found
javax.crypto.IllegalBlockSizeException - Block size is invalide (Cipher)

inputContent

protected void inputContent(java.io.InputStream is)
                     throws java.io.IOException
Description copied from class: CMSContentInfo
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.

Specified by:
inputContent in class CMSContentInfo
Throws:
java.io.IOException

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.
Overrides:
update in class CMSContentInfo

Skip navigation links

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

E10667-02


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