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

B15564-01


oracle.security.crypto.cms
Class CMSEnvelopedDataContentInfo

java.lang.Object
  extended byoracle.security.crypto.cms.CMSContentInfo
      extended byoracle.security.crypto.cms.CMSEnvelopedDataContentInfo


public class CMSEnvelopedDataContentInfo
extends CMSContentInfo

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


Constructor Summary
CMSEnvelopedDataContentInfo()
Creates an empty CMSEnvelopedDataContentInfo.
CMSEnvelopedDataContentInfo(CMSContentInfo contentInfo, AlgorithmIdentifier contentEncryptionAlgID)
Creates a CMSEnvelopedDataContentInfo.
CMSEnvelopedDataContentInfo(java.io.InputStream is)
Creates a CMSEnvelopedDataContentInfo object, by reading a BER encoding from the specified input stream.

Method Summary
void addRecipient(AlgorithmIdentifier keyEncryptionAlgID, SymmetricKey keyEncryptionKey, byte[] keyIdentifier, java.util.Date keyDate, ASN1Sequence otherKeyAttribute)
Add a recipient.
void addRecipient(CMSRecipientInfoSpec ris)
Add a recipient.
void addRecipient(oracle.security.crypto.cert.X509 recipientCert, AlgorithmIdentifier keyEncryptionAlgID)
Add a recipient.
void addRecipient(oracle.security.crypto.cert.X509 recipientCert, AlgorithmIdentifier keyEncryptionAlgID, boolean useSPKI64)
Add a recipient.
boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.
AlgorithmIdentifier getContentEncryptionAlgID()
Returns the content encryption algorithm.
CMSContentInfo getEnclosed(PrivateKey privateKey, oracle.security.crypto.cert.X509 recipientCert)
Returns the enclosed content after decryption.
CMSContentInfo getEnclosed(SymmetricKey symmetricKey, byte[] keyIdentifier)
Returns the enclosed content after decryption.
CMSContentInfo getEnclosed(SymmetricKey symmetricKey, byte[] keyIdentifier, java.util.Date keyDate)
Returns the enclosed content after decryption.
CMSContentInfo getEnclosed(SymmetricKey symmetricKey, byte[] keyIdentifier, java.util.Date keyDate, ASN1Sequence otherKeyAttribute)
Returns the enclosed content after decryption.
ASN1ObjectID getEnclosedContentType()
Returns the content type of the encrypted content.
byte[] getEncryptedContent()
Returns the enclosed content which is encrypted.
protected byte[] getExposedContent()
Returns the contents octets of the DER encoding of the content field of this CMS object.
OriginatorInfo getOriginatorInfo()
Returns the OriginatorInfo.
oracle.security.crypto.cert.AttributeSet getUnprotectedAttribs()
Returns the unprotected attributes.
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()
Indicates if the encrypted content is not present.
java.util.Enumeration recipients()
Returns the list of message recipients.
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 setOriginatorInfo(OriginatorInfo origInfo)
Sets the OriginatorInfo.
void setUnprotectedAttribs(oracle.security.crypto.cert.AttributeSet unprotectedAttributes)
Set 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 writeDetached)
Indicate if the encrypted content must be omitted from 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

CMSEnvelopedDataContentInfo

public CMSEnvelopedDataContentInfo()
Creates an empty CMSEnvelopedDataContentInfo.

CMSEnvelopedDataContentInfo

public CMSEnvelopedDataContentInfo(CMSContentInfo contentInfo,
                                   AlgorithmIdentifier contentEncryptionAlgID)
                            throws CipherException,
                                   AlgorithmIdentifierException
Creates a CMSEnvelopedDataContentInfo.
Parameters:
contentInfo - The document to encrypt.
contentEncryptionAlgID - The content encryption algorithm.

CMSEnvelopedDataContentInfo

public CMSEnvelopedDataContentInfo(java.io.InputStream is)
                            throws java.io.IOException
Creates a CMSEnvelopedDataContentInfo 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, has the wrong content type, or an I/O error occurs while reading from the input stream.

Method Detail

isDetached

public boolean isDetached()
Indicates if the encrypted content is not present.
Specified by:
isDetached in class CMSContentInfo
Returns:
If true the encrypted content is not present; false otherwise.

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
Returns:
The contents octets or null for a detached CMS object.
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()

getVersionNumber

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

getVersion

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

getEnclosedContentType

public ASN1ObjectID getEnclosedContentType()
Returns the content type of the encrypted content.
Returns:
The content type identifier.

getContentEncryptionAlgID

public AlgorithmIdentifier getContentEncryptionAlgID()
Returns the content encryption algorithm.
Returns:
The encryption algorithm identfier.

toString

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

recipients

public java.util.Enumeration recipients()
Returns the list of message recipients.
Returns:
An enumeration of CMSRecipientInfo objects.

hashCode

public int hashCode()
Returns a hash code value for this object.
Returns:
The hash code value.

equals

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

writeDetached

public void writeDetached(boolean writeDetached)
Indicate if the encrypted content must be omitted from this object's output encoding.
Parameters:
writeDetached - true if the encrypted content is to be omitted from this object's encoded output; false otherwise.
See Also:
CMSContentInfo.isDetached()

setEnclosed

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

addRecipient

public void addRecipient(oracle.security.crypto.cert.X509 recipientCert,
                         AlgorithmIdentifier keyEncryptionAlgID)
                  throws AlgorithmIdentifierException,
                         CipherException,
                         InvalidKeyException
Add a recipient.

Uses the Key Transport Recipient Information with IssuerAndSerialNumber as the Recipient Identifier.

Parameters:
recipientCert - The recipient's public key certificate.
keyEncryptionAlgID - The key encipherment algorithm.
Throws:
AlgorithmIdentifierException - Unrecognized algorithm identifier.
CipherException - An error occurred during encryption.
InvalidKeyException - Invalid content encryption key.

addRecipient

public void addRecipient(oracle.security.crypto.cert.X509 recipientCert,
                         AlgorithmIdentifier keyEncryptionAlgID,
                         boolean useSPKI64)
                  throws AlgorithmIdentifierException,
                         CipherException,
                         InvalidKeyException
Add a recipient.

Uses the Key Transport Recipient Information with Subject Key Identifier as the Recipient Identifier.

Parameters:
recipientCert - The recipient's public key certificate.
keyEncryptionAlgID - The key encipherment algorithm.
useSPKI64 - Uses Subject Public Key Identifier as the recipient identifier. true use 64 bit PKI; false use 160 bit SPKI.
Throws:
AlgorithmIdentifierException - Unrecognized algorithm identifier.
CipherException - An error occurred during encryption.
InvalidKeyException - Invalid content encryption key.

addRecipient

public void addRecipient(CMSRecipientInfoSpec ris)
                  throws AlgorithmIdentifierException,
                         CipherException,
                         InvalidInputException,
                         InvalidKeyException
Add a recipient.

Uses the Key Encryption Key Recipient Information.

Parameters:
ris - The recipient's information.
Throws:
InvalidInputException - Unrecognized RecipientInfoSpec.
AlgorithmIdentifierException - Unrecognized algorithm identifier.
CipherException - An error occurred during encryption.
InvalidKeyException - Invalid content encryption key.

addRecipient

public void addRecipient(AlgorithmIdentifier keyEncryptionAlgID,
                         SymmetricKey keyEncryptionKey,
                         byte[] keyIdentifier,
                         java.util.Date keyDate,
                         ASN1Sequence otherKeyAttribute)
                  throws AlgorithmIdentifierException,
                         CipherException,
                         InvalidKeyException,
                         InvalidInputException
Add a recipient.

Uses the Key Encryption Key Recipient Information.

Throws:
AlgorithmIdentifierException - Unrecognized algorithm identifier.
CipherException - An error occurred during encryption.
InvalidKeyException - Invalid content encryption key.
InvalidInputException

getEnclosed

public CMSContentInfo getEnclosed(PrivateKey privateKey,
                                  oracle.security.crypto.cert.X509 recipientCert)
                           throws AlgorithmIdentifierException,
                                  InvalidKeyException,
                                  CipherException,
                                  UnknownRecipientException,
                                  InvalidInputException
Returns the enclosed content after decryption.

Assumes that Key Transport Recipient Information is used.

Returns:
The decrypted CMS object.
Throws:
AlgorithmIdentifierException - Unrecognized algorithm identifier.
CipherException - An error occurred during encryption.
InvalidKeyException - Invalid content encryption key.
UnknownRecipientException - The decryption key does belong to the recipient.
InvalidInputException - If an incorrect encoding or I/O error occurred.

getEnclosed

public CMSContentInfo getEnclosed(SymmetricKey symmetricKey,
                                  byte[] keyIdentifier)
                           throws AlgorithmIdentifierException,
                                  InvalidKeyException,
                                  CipherException,
                                  UnknownRecipientException,
                                  InvalidInputException
Returns the enclosed content after decryption.

Assumes that Key Encryption Key Recipient Information is used.

Parameters:
symmetricKey - The previously distributed symmetric key.
keyIdentifier - Key identifier.
Returns:
The decrypted CMS object.
Throws:
AlgorithmIdentifierException - Unrecognized algorithm identifier.
CipherException - An error occurred during encryption.
InvalidKeyException - Invalid content encryption key.
UnknownRecipientException - The decryption key does belong to the recipient.
InvalidInputException - If an incorrect encoding or I/O error occurred.

getEnclosed

public CMSContentInfo getEnclosed(SymmetricKey symmetricKey,
                                  byte[] keyIdentifier,
                                  java.util.Date keyDate)
                           throws AlgorithmIdentifierException,
                                  InvalidKeyException,
                                  CipherException,
                                  UnknownRecipientException,
                                  InvalidInputException
Returns the enclosed content after decryption.

Assumes that Key Encryption Key Recipient Information is used.

Parameters:
symmetricKey - The previously distributed symmetric key.
keyIdentifier - Key identifier.
keyDate - Key generation date.
Returns:
The decrypted CMS object.
Throws:
AlgorithmIdentifierException - Unrecognized algorithm identifier.
CipherException - An error occurred during encryption.
InvalidKeyException - Invalid content encryption key.
UnknownRecipientException - The decryption key does belong to the recipient.
InvalidInputException - If an incorrect encoding or I/O error occurred.

getEnclosed

public CMSContentInfo getEnclosed(SymmetricKey symmetricKey,
                                  byte[] keyIdentifier,
                                  java.util.Date keyDate,
                                  ASN1Sequence otherKeyAttribute)
                           throws AlgorithmIdentifierException,
                                  InvalidKeyException,
                                  CipherException,
                                  UnknownRecipientException,
                                  InvalidInputException
Returns the enclosed content after decryption.

Assumes that Key Encryption Key Recipient Information is used.

Parameters:
symmetricKey - The previously distributed symmetric key.
keyIdentifier - Key identifier.
keyDate - Key generation date.
otherKeyAttribute - The Other Key Attribute.
Returns:
The decrypted CMS object.
Throws:
AlgorithmIdentifierException - Unrecognized algorithm identifier.
CipherException - An error occurred during encryption.
InvalidKeyException - Invalid content encryption key.
UnknownRecipientException - The decryption key does belong to the recipient.
InvalidInputException - If an incorrect encoding or I/O error occurred.

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

getEncryptedContent

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

setOriginatorInfo

public void setOriginatorInfo(OriginatorInfo origInfo)
Sets the OriginatorInfo.

Do not use this method if PKCS#7 v1.5 interoperability is required.

Parameters:
origInfo - The OriginatorInfo.

getOriginatorInfo

public OriginatorInfo getOriginatorInfo()
Returns the OriginatorInfo.
Returns:
The OriginatorInfo if present or null otherwise.

setUnprotectedAttribs

public void setUnprotectedAttribs(oracle.security.crypto.cert.AttributeSet unprotectedAttributes)
Set the unprotected attributes.
Parameters:
unprotectedAttributes - The unprotected attributes.

getUnprotectedAttribs

public oracle.security.crypto.cert.AttributeSet getUnprotectedAttribs()
Returns the unprotected attributes.
Returns:
The set of unprotected attributes if present or null otherwise.

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

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

B15564-01


Copyright © 2005 , Oracle. All rights reserved.