Skip navigation links

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

E10667-02


oracle.security.crypto.cms
Class CMSKeyTransRecipientInfo

java.lang.Object
  extended by oracle.security.crypto.cms.CMSRecipientInfo
      extended by oracle.security.crypto.cms.CMSKeyTransRecipientInfo

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

public class CMSKeyTransRecipientInfo
extends CMSRecipientInfo

This class encapsulates recipient information using the Key Transport key exchange mechanism.

See Also:
CMSRecipientInfo, CMSKeyTransRecipientInfoSpec

Constructor Summary
CMSKeyTransRecipientInfo()
          Creates an empty CMSKeyTransRecipientInfo.
CMSKeyTransRecipientInfo(byte[] hmacKey, java.lang.String hmacKeyAlgo, java.security.PublicKey keyEncryptionKey, byte[] spki, oracle.security.crypto.core.AlgorithmIdentifier keyEncryptionAlgID)
          Creates a CMSKeyTransRecipientInfo.
CMSKeyTransRecipientInfo(byte[] hmacKey, java.lang.String hmacKeyAlgo, java.security.PublicKey keyEncryptionKey, oracle.security.crypto.cert.IssuerAndSerialNo iasn, oracle.security.crypto.core.AlgorithmIdentifier keyEncryptionAlgID)
          Creates a CMSKeyTransRecipientInfo.
CMSKeyTransRecipientInfo(java.io.InputStream is)
          Creates a CMSKeyTransRecipientInfo by reading the BER encoding from the specified input stream.
CMSKeyTransRecipientInfo(javax.crypto.SecretKey contentEncryptionKey, java.security.PublicKey keyEncryptionKey, byte[] spki, oracle.security.crypto.core.AlgorithmIdentifier keyEncryptionAlgID)
          Creates a CMSKeyTransRecipientInfo.
CMSKeyTransRecipientInfo(javax.crypto.SecretKey contentEncryptionKey, java.security.PublicKey keyEncryptionKey, oracle.security.crypto.cert.IssuerAndSerialNo iasn, oracle.security.crypto.core.AlgorithmIdentifier keyEncryptionAlgID)
          Creates a CMSKeyTransRecipientInfo.

 

Method Summary
 boolean equals(java.lang.Object obj)
          Indicates whether some other object is "equal to" this one.
 byte[] getContentAuthenticationKey(java.security.PrivateKey keyDecryptionKey)
          Derives the content authentication key, by decryption the encrypted key stored in this object with the given key decryption key.
 byte[] getContentEncryptionKey(java.security.PrivateKey keyDecryptionKey)
          Derives the content encryption key, by decryption the encrypted key stored in this object with the given key decryption key.
 byte[] getContentEncryptionKey(java.security.PrivateKey keyDecryptionKey, java.lang.String contentEncryptionAlgo)
          Derives the content encryption key, by decryption the encrypted key stored in this object with the given key decryption key.
 byte[] getEncryptedKey()
          Returns the encrypted content encryption key.
 oracle.security.crypto.cert.IssuerAndSerialNo getIASN()
          Returns the IssuerAndSerialNo recipient identifier.
 oracle.security.crypto.cert.X500Name getIssuer()
          Returns the issuer of the recipient's certificate.
 java.lang.String getKeyAlgo()
          This method returns the ContentEncryptionkey's Algorithm.
 oracle.security.crypto.core.AlgorithmIdentifier getKeyEncryptionAlgID()
          Returns the Key Wrapping or Encipherment Algorithm.
 java.math.BigInteger getSerialNo()
          Returns the serial number of the recipient's certificate.
 byte[] getSPKI()
          Returns the Subject Public Key Identifier.
 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 inputRecipientInfo(java.io.InputStream is)
          Reads the CMSRecipientInfo structure.
 int length()
          Returns the length of this object's encoding.
 void output(java.io.OutputStream os)
          Output this object's encoding to the specified output stream.
 java.lang.String toString()
          A brief textual description of this object.
 boolean useSPKI64()
          Indicated if SPKI is being used as the Recipient Identifier.

 

Methods inherited from class oracle.security.crypto.cms.CMSRecipientInfo
input, inputInstance

 

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

 

Constructor Detail

CMSKeyTransRecipientInfo

public CMSKeyTransRecipientInfo()
Creates an empty CMSKeyTransRecipientInfo.

CMSKeyTransRecipientInfo

public CMSKeyTransRecipientInfo(javax.crypto.SecretKey contentEncryptionKey,
                                java.security.PublicKey keyEncryptionKey,
                                oracle.security.crypto.cert.IssuerAndSerialNo iasn,
                                oracle.security.crypto.core.AlgorithmIdentifier keyEncryptionAlgID)
                         throws java.security.NoSuchAlgorithmException,
                                javax.crypto.NoSuchPaddingException,
                                java.security.InvalidKeyException,
                                javax.crypto.IllegalBlockSizeException,
                                javax.crypto.BadPaddingException
Creates a CMSKeyTransRecipientInfo.

Note the changes in the Method signature

Previously public CMSKeyTransRecipientInfo (SymmetricKey ,oracle.security.crypto.core.PublicKey , IssuerAndSerialNo, AlgorithmIdentifier )

Now public CMSKeyTransRecipientInfo (SecretKey , java.security.PublicKey , IssuerAndSerialNo, AlgorithmIdentifier )

Exceptions no longer thrown --AlgorithmIdentifierException and CipherException . Exceptions included -- NoSuchAlgorithmException, NoSuchPaddingException,IllegalBlockSizeException , BadPaddingException

Parameters:
contentEncryptionKeyBytes - The content Encryption key Bytes
keyEncryptionKey - The key encipherment(wrap) key.
iasn - Issuer and Serial Number (IASN) of the recipient's certificate.
keyEncryptionAlgID - The key encipherment(wrap) algorithm.
Throws:
java.security.InvalidKeyException - The encryption keys are not valid.
java.security.NoSuchAlgorithmException - Algo not available
javax.crypto.NoSuchPaddingException - Requested Padding not available
javax.crypto.IllegalBlockSizeException - Length of data doesnt match block size
javax.crypto.BadPaddingException - Data without expected padding

CMSKeyTransRecipientInfo

public CMSKeyTransRecipientInfo(java.io.InputStream is)
                         throws java.io.IOException
Creates a CMSKeyTransRecipientInfo by reading the BER encoding from the specified input stream.
Parameters:
is - The input stream.
Throws:
java.io.IOException - If the input encoding is incorrect or an I/O error occurs.

CMSKeyTransRecipientInfo

public CMSKeyTransRecipientInfo(javax.crypto.SecretKey contentEncryptionKey,
                                java.security.PublicKey keyEncryptionKey,
                                byte[] spki,
                                oracle.security.crypto.core.AlgorithmIdentifier keyEncryptionAlgID)
                         throws java.security.NoSuchAlgorithmException,
                                javax.crypto.NoSuchPaddingException,
                                java.security.InvalidKeyException,
                                javax.crypto.IllegalBlockSizeException,
                                javax.crypto.BadPaddingException
Creates a CMSKeyTransRecipientInfo.

Note the changes in the Method signature

Previouslypublic CMSKeyTransRecipientInfo (SymmetricKey , oracle.security.crypto.core.PublicKey , byte[], AlgorithmIdentifier )

Now public CMSKeyTransRecipientInfo (SecretKey , java.security.PublicKey , byte[], AlgorithmIdentifier )

Exceptions no longer thrown -- AlgorithmIdentifierException and CipherException . Exceptions included -- NoSuchAlgorithmException, NoSuchPaddingException,IllegalBlockSizeException , BadPaddingException

Parameters:
contentEncryptionKey - The ContentEncryption Key
keyEncryptionKey - The key encipherment(wrap) key.
spki - The recipient's Subject Public Key Identifier(SPKI) value.
keyEncryptionAlgID - The key encipherment(wrap) algorithm.
Throws:
java.security.InvalidKeyException - The encryption keys are not valid.
java.security.NoSuchAlgorithmException - Algo not available
javax.crypto.NoSuchPaddingException - Requested Padding not available
javax.crypto.IllegalBlockSizeException - Length of data doesnt match block size
javax.crypto.BadPaddingException - Data without expected padding
See Also:
CMSUtils

CMSKeyTransRecipientInfo

public CMSKeyTransRecipientInfo(byte[] hmacKey,
                                java.lang.String hmacKeyAlgo,
                                java.security.PublicKey keyEncryptionKey,
                                oracle.security.crypto.cert.IssuerAndSerialNo iasn,
                                oracle.security.crypto.core.AlgorithmIdentifier keyEncryptionAlgID)
                         throws java.security.NoSuchAlgorithmException,
                                javax.crypto.NoSuchPaddingException,
                                java.security.InvalidKeyException,
                                javax.crypto.IllegalBlockSizeException,
                                javax.crypto.BadPaddingException
Creates a CMSKeyTransRecipientInfo.

Note the changes in the Method signature

Previouslypublic CMSKeyTransRecipientInfo (byte[], oracle.security.crypto.core.PublicKey , IssuerAndSerialNo , AlgorithmIdentifier )

Now public CMSKeyTransRecipientInfo (byte[],java.security.PublicKey , IssuerAndSerialNo , AlgorithmIdentifier )

Exceptions no longer thrown -- AlgorithmIdentifierException and CipherException . Exceptions included -- NoSuchAlgorithmException, NoSuchPaddingException,IllegalBlockSizeException , BadPaddingException

Parameters:
hmacKey - The HMAC key.
keyEncryptionKey - The key encipherment(wrap) key.
spki - The recipient's Subject Public Key Identifier(SPKI) value.
keyEncryptionAlgID - The key encipherment(wrap) algorithm.
Throws:
java.security.InvalidKeyException - The encryption keys are not valid.
java.security.NoSuchAlgorithmException - Algo not available
javax.crypto.NoSuchPaddingException - Requested Padding not available
javax.crypto.IllegalBlockSizeException - Length of data doesnt match block size
javax.crypto.BadPaddingException - Data without expected padding

CMSKeyTransRecipientInfo

public CMSKeyTransRecipientInfo(byte[] hmacKey,
                                java.lang.String hmacKeyAlgo,
                                java.security.PublicKey keyEncryptionKey,
                                byte[] spki,
                                oracle.security.crypto.core.AlgorithmIdentifier keyEncryptionAlgID)
                         throws java.security.NoSuchAlgorithmException,
                                javax.crypto.NoSuchPaddingException,
                                java.security.InvalidKeyException,
                                javax.crypto.IllegalBlockSizeException,
                                javax.crypto.BadPaddingException
Creates a CMSKeyTransRecipientInfo.

Note the changes in the Method signature

Previouslypublic CMSKeyTransRecipientInfo (byte[], oracle.security.crypto.core.PublicKey , byte[], AlgorithmIdentifier )

Now public CMSKeyTransRecipientInfo (byte[],java.security.PublicKey , byte[] , AlgorithmIdentifier )

Exceptions no longer thrown -- AlgorithmIdentifierException and CipherException . Exceptions included -- NoSuchAlgorithmException, NoSuchPaddingException,IllegalBlockSizeException , BadPaddingException

Parameters:
hmacKey - The MAC key.
keyEncryptionKey - The key encipherment(wrap) key.
spki - The recipient's Subject Public Key Identifier(SPKI) value.
keyEncryptionAlgID - The key encipherment(wrap) algorithm.
Throws:
java.security.InvalidKeyException - The encryption keys are not valid.
java.security.NoSuchAlgorithmException - Algo not available
javax.crypto.NoSuchPaddingException - Requested Padding not available
javax.crypto.IllegalBlockSizeException - Length of data doesnt match block size
javax.crypto.BadPaddingException - Data without expected padding

Method Detail

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.

getIASN

public oracle.security.crypto.cert.IssuerAndSerialNo getIASN()
Returns the IssuerAndSerialNo recipient identifier.
Returns:
The IssuerAndSerialNo recipient identifier or null if SPKI is used as the recipient identifier.

getSerialNo

public java.math.BigInteger getSerialNo()
Returns the serial number of the recipient's certificate.
Returns:
The serial number.

getIssuer

public oracle.security.crypto.cert.X500Name getIssuer()
Returns the issuer of the recipient's certificate.
Returns:
The issuer DN.

getKeyEncryptionAlgID

public oracle.security.crypto.core.AlgorithmIdentifier getKeyEncryptionAlgID()
Returns the Key Wrapping or Encipherment Algorithm.
Returns:
The key wrap algorithm identifier.

getEncryptedKey

public byte[] getEncryptedKey()
Returns the encrypted content encryption key.
Returns:
The enciphered key.

getSPKI

public byte[] getSPKI()
Returns the Subject Public Key Identifier.
Returns:
The SPKI value.

useSPKI64

public boolean useSPKI64()
Indicated if SPKI is being used as the Recipient Identifier.
Returns:
true if SPKI is being used; false if IASN is being used.

getKeyAlgo

public java.lang.String getKeyAlgo()
This method returns the ContentEncryptionkey's Algorithm. after the encrypted key is decrypted to get the key bytes, the Algorithm and the keybytes are used to create an instance of SecretKey
Returns:
the Algorithm of the contentEncryptionkey

getContentEncryptionKey

public byte[] getContentEncryptionKey(java.security.PrivateKey keyDecryptionKey)
                               throws java.security.NoSuchAlgorithmException,
                                      javax.crypto.NoSuchPaddingException,
                                      java.security.InvalidKeyException,
                                      javax.crypto.IllegalBlockSizeException,
                                      javax.crypto.BadPaddingException
Derives the content encryption key, by decryption the encrypted key stored in this object with the given key decryption key.

Note the changes in the Method signature

Previously public SymmetricKey getContentEncryptionKey (oracle.security.crypto.core.PrivateKey )

Now public byte[] getContentEncryptionKey (java.security.PrivateKey)

Exceptions no longer thrown -- AlgorithmIdentifierException and CipherException . Exceptions included -- NoSuchAlgorithmException, NoSuchPaddingException,IllegalBlockSizeException , BadPaddingException

Parameters:
keyDecryptionKey - The key decryption key.
Returns:
The content encryption key bytes.
Throws:
java.security.InvalidKeyException - The encryption keys are not valid.
java.security.NoSuchAlgorithmException - Algo not available
javax.crypto.NoSuchPaddingException - Requested Padding not available
javax.crypto.IllegalBlockSizeException - Length of data doesnt match block size
javax.crypto.BadPaddingException - Data without expected padding

getContentEncryptionKey

public byte[] getContentEncryptionKey(java.security.PrivateKey keyDecryptionKey,
                                      java.lang.String contentEncryptionAlgo)
                               throws java.security.NoSuchAlgorithmException,
                                      javax.crypto.NoSuchPaddingException,
                                      java.security.InvalidKeyException,
                                      javax.crypto.IllegalBlockSizeException,
                                      javax.crypto.BadPaddingException
Derives the content encryption key, by decryption the encrypted key stored in this object with the given key decryption key.

Note the changes in the Method signature

Previously public SymmetricKey getContentEncryptionKey (oracle.security.crypto.core.PrivateKey )

Now public byte[] getContentEncryptionKey (java.security.PrivateKey)

Exceptions no longer thrown -- AlgorithmIdentifierException and CipherException . Exceptions included -- NoSuchAlgorithmException, NoSuchPaddingException,IllegalBlockSizeException , BadPaddingException

Parameters:
keyDecryptionKey - The key decryption key.
Returns:
The content encryption key bytes.
Throws:
java.security.InvalidKeyException - The encryption keys are not valid.
java.security.NoSuchAlgorithmException - Algo not available
javax.crypto.NoSuchPaddingException - Requested Padding not available
javax.crypto.IllegalBlockSizeException - Length of data doesnt match block size
javax.crypto.BadPaddingException - Data without expected padding

getContentAuthenticationKey

public byte[] getContentAuthenticationKey(java.security.PrivateKey keyDecryptionKey)
                                   throws java.security.NoSuchAlgorithmException,
                                          javax.crypto.NoSuchPaddingException,
                                          java.security.InvalidKeyException,
                                          javax.crypto.IllegalBlockSizeException,
                                          javax.crypto.BadPaddingException
Derives the content authentication key, by decryption the encrypted key stored in this object with the given key decryption key.

Note the changes in the Method signature

Previously public byte[] getContentAuthenticationKey (oracle.security.crypto.core.PrivateKey )

Now public byte[] getContentAuthenticationKey (java.security.PrivateKey)

Exceptions no longer thrown -- AlgorithmIdentifierException and CipherException . Exceptions included -- NoSuchAlgorithmException, NoSuchPaddingException,IllegalBlockSizeException , BadPaddingException

Parameters:
keyDecryptionKey - The key decryption key.
Returns:
The content authentication key.
Throws:
java.security.InvalidKeyException - The encryption keys are not valid.
java.security.NoSuchAlgorithmException - Algo not available
javax.crypto.NoSuchPaddingException - Requested Padding not available
javax.crypto.IllegalBlockSizeException - Length of data doesnt match block size
javax.crypto.BadPaddingException - Data without expected padding

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.
Specified by:
getVersion in class CMSRecipientInfo
Returns:
The version number.

inputRecipientInfo

protected void inputRecipientInfo(java.io.InputStream is)
                           throws java.io.IOException
Description copied from class: CMSRecipientInfo
Reads the CMSRecipientInfo structure. This method must be implemented by subclasses.

The input stream is positioned at the beginning of the tag octet of the SEQUENCE encoding.

Specified by:
inputRecipientInfo in class CMSRecipientInfo
Parameters:
is - The input stream.
Throws:
java.io.IOException - The encoding is incorrect or an I/O error occurs.

output

public void output(java.io.OutputStream os)
            throws java.io.IOException
Output this object's encoding to the specified output stream.
Parameters:
os - The specified output stream.
Throws:
java.io.IOException - An I/O error occurred.

length

public int length()
Returns the length of this object's encoding.
Returns:
The length in bytes.

toString

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

Skip navigation links

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

E10667-02


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