com.rsa.certj.pkcs7

Class RecipientInfo

java.lang.Object
  |
  +--com.rsa.certj.pkcs7.RecipientInfo
All Implemented Interfaces:
Cloneable, Serializable

public class RecipientInfo
extends Object
implements Cloneable, Serializable

This class defines the RecipientInfo structure that represents per-recipient information.

The ASN.1 definition is as follows:

 RecipientInfo ::= SEQUENCE {
    version Version,
    issuerAndSerialNumber IssuerAndSerialNumber,
    keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
    encryptedKey EncryptedKey }

 Version ::= INTEGER                        -- a syntax version number

 IssuerAndSerialNumber ::= SEQUENCE {
    issuer Name,
    serialNumber CertificateSerialNumber }
       -- identifies the recipient's certificate (and thereby the
          recipient's distinguished name and a public key)
          by issuer distinguished name and an issuer-specific serial number.

 KeyEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier
       -- the key-encryption algorithm (and any associated parameters) under
          which the content-encryption key is encrypted with recipient's
          public key.
          
 EncryptedKey ::= OCTET STRING
 

Copyright © RSA Security Inc., 1999-2001. All rights reserved.

See Also

Serialized Form

Constructor Summary

RecipientInfo()

Constructs an empty RecipientInfo object.

 

Method Summary

 Object

clone()

Overrides the default clone method to get a deeper clone.

 boolean

equals(Object obj)

Returns true if this object and obj contain the same RecipientInfo; returns false otherwise.

 byte[]

getEncryptedKey()

Gets the encrypted key data.

 String

getEncryptionAlgorithmName()

Gets the key-encryption algorithm name.

 byte[]

getEncryptionAlgorithmOID()

Gets the key-encryption algorithm OID.

 X500Name

getIssuerName()

Gets the issuer name of the recipient's certificate.

 byte[]

getSerialNumber()

Gets the serial number of the reciptient's certificate.

 int

getVersionNumber()

Gets the the version number.

 void

setEncryptionAlgorithm(byte[] encryptOID, int offset, int len)

Sets the key-encryption algorithm identifier.

 void

setEncryptionAlgorithm(String algName)

Sets the key-encryption algorithm identifier, for example, RSA/PKCS1Block02Pad.

 void

setIssuerAndSerialNumber(X500Name name, byte[] number, int offset, int length)

Sets the issuer and serial number that specifies the recipient's certificate.

 void

setVersionNumber(int version)

Sets the version number.

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

Constructor Detail

RecipientInfo

public RecipientInfo()
Constructs an empty RecipientInfo object.
Method Detail

setVersionNumber

public void setVersionNumber(int version)
Sets the version number.

Parameters

         version  

The version number to set.


getVersionNumber

public int getVersionNumber()
Gets the the version number.

Returns

The syntax version number.

setIssuerAndSerialNumber

public void setIssuerAndSerialNumber(X500Name name,
                                     byte[] number,
                                     int offset,
                                     int length)
                              throws PKCS7Exception
Sets the issuer and serial number that specifies the recipient's certificate. Doing so also sets the recipient's distinguished name and public key.

Parameters

         name  

An X500Name object that contains the issuer distinguished name.

         number  

A byte array that contains the issuer-specific serial number.

         offset  

The offset into the number array.

         length  

The length of the data in the number array.

Throws

PKCS7Exception - If the issuer and serial number cannot be set or the values are null.

getIssuerName

public X500Name getIssuerName()
                       throws PKCS7Exception
Gets the issuer name of the recipient's certificate.

Returns

A X500Name object that contains the issuer distinguished name.

Throws

PKCS7Exception - If the issuer distinguished name cannot be returned.

getSerialNumber

public byte[] getSerialNumber()
Gets the serial number of the reciptient's certificate.

Returns

A byte array that contains the issuer-specific serial number.

setEncryptionAlgorithm

public void setEncryptionAlgorithm(String algName)
                            throws PKCS7Exception
Sets the key-encryption algorithm identifier, for example, RSA/PKCS1Block02Pad.

Parameters

         algName  

A String that identifies the key-encryption algorithm.

Throws

PKCS7Exception - If algName is invalid or null.

setEncryptionAlgorithm

public void setEncryptionAlgorithm(byte[] encryptOID,
                                   int offset,
                                   int len)
                            throws PKCS7Exception
Sets the key-encryption algorithm identifier.

Parameters

         encryptOID  

A byte array that contains the key-encryption algorithm (and any associated parameters) under which the content-encryption key is encrypted with the recipient's public key.

         offset  

The offset into encryptOID array.

         len  

The length of data in the encryptOID array.

Throws

PKCS7Exception - If the OID is null.

getEncryptionAlgorithmOID

public byte[] getEncryptionAlgorithmOID()
Gets the key-encryption algorithm OID.

Returns

The key-encryption algorithm OID.

getEncryptionAlgorithmName

public String getEncryptionAlgorithmName()
                                  throws PKCS7Exception
Gets the key-encryption algorithm name.

Returns

The key-encryption algorithm name.

Throws

PKCS7Exception - If the algorithm name cannot be retrieved.

getEncryptedKey

public byte[] getEncryptedKey()
Gets the encrypted key data.

Returns

The result of encrypting the content-encryption key with the recipient's public key.

equals

public boolean equals(Object obj)
Returns true if this object and obj contain the same RecipientInfo; returns false otherwise.

Overrides

equals in class Object

Parameters

         obj  

An instance of the RecipientInfo class.

Returns

A boolean indicating whether these objects are equal.

clone

public Object clone()
             throws CloneNotSupportedException
Overrides the default clone method to get a deeper clone.

Returns

A new RecipientInfo object, a copy of this object.

Throws

CloneNotSupportedException - If the cloning operation is not successful.


RSA BSAFE ® Cert-J 2.1.1 001-047007-211-001-000