Bouncy Castle Cryptography 1.46

org.bouncycastle.cms
Class RecipientInformation

java.lang.Object
  extended by org.bouncycastle.cms.RecipientInformation
Direct Known Subclasses:
KEKRecipientInformation, KeyAgreeRecipientInformation, KeyTransRecipientInformation, PasswordRecipientInformation

public abstract class RecipientInformation
extends java.lang.Object


Field Summary
protected  AlgorithmIdentifier keyEncAlg
           
protected  AlgorithmIdentifier messageAlgorithm
           
protected  RecipientId rid
           
 
Method Summary
 byte[] getContent(java.security.Key key, java.security.Provider provider)
          Deprecated. use getContent(Recipient)
 byte[] getContent(java.security.Key key, java.lang.String provider)
          Deprecated. use getContent(Recipient)
 byte[] getContent(Recipient recipient)
          Return the decrypted/encapsulated content in the EnvelopedData after recovering the content encryption/MAC key using the passed in Recipient.
 byte[] getContentDigest()
          Return the content digest calculated during the read of the content if one has been generated.
protected  CMSTypedStream getContentFromSessionKey(java.security.Key sKey, java.security.Provider provider)
           
abstract  CMSTypedStream getContentStream(java.security.Key key, java.security.Provider provider)
          Deprecated. use getContentStream(Recipient) method
 CMSTypedStream getContentStream(java.security.Key key, java.lang.String provider)
          Deprecated. use getContentStream(Recipient) method
 CMSTypedStream getContentStream(Recipient recipient)
          Return a CMSTypedStream representing the content in the EnvelopedData after recovering the content encryption/MAC key using the passed in Recipient.
 java.lang.String getKeyEncryptionAlgOID()
          return the object identifier for the key encryption algorithm.
 java.security.AlgorithmParameters getKeyEncryptionAlgorithmParameters(java.security.Provider provider)
          Return an AlgorithmParameters object giving the encryption parameters used to encrypt the key this recipient holds.
 java.security.AlgorithmParameters getKeyEncryptionAlgorithmParameters(java.lang.String provider)
          Return an AlgorithmParameters object giving the encryption parameters used to encrypt the key this recipient holds.
 byte[] getKeyEncryptionAlgParams()
          return the ASN.1 encoded key encryption algorithm parameters, or null if there aren't any.
 byte[] getMac()
          Return the MAC calculated for the recipient.
protected abstract  RecipientOperator getRecipientOperator(Recipient recipient)
           
 RecipientId getRID()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rid

protected RecipientId rid

keyEncAlg

protected AlgorithmIdentifier keyEncAlg

messageAlgorithm

protected AlgorithmIdentifier messageAlgorithm
Method Detail

getRID

public RecipientId getRID()

getKeyEncryptionAlgOID

public java.lang.String getKeyEncryptionAlgOID()
return the object identifier for the key encryption algorithm.

Returns:
OID for key encryption algorithm.

getKeyEncryptionAlgParams

public byte[] getKeyEncryptionAlgParams()
return the ASN.1 encoded key encryption algorithm parameters, or null if there aren't any.

Returns:
ASN.1 encoding of key encryption algorithm parameters.

getKeyEncryptionAlgorithmParameters

public java.security.AlgorithmParameters getKeyEncryptionAlgorithmParameters(java.lang.String provider)
                                                                      throws CMSException,
                                                                             java.security.NoSuchProviderException
Return an AlgorithmParameters object giving the encryption parameters used to encrypt the key this recipient holds.

Parameters:
provider - the provider to generate the parameters for.
Returns:
the parameters object, null if there is not one.
Throws:
CMSException - if the algorithm cannot be found, or the parameters can't be parsed.
java.security.NoSuchProviderException - if the provider cannot be found.

getKeyEncryptionAlgorithmParameters

public java.security.AlgorithmParameters getKeyEncryptionAlgorithmParameters(java.security.Provider provider)
                                                                      throws CMSException
Return an AlgorithmParameters object giving the encryption parameters used to encrypt the key this recipient holds.

Parameters:
provider - the provider to generate the parameters for.
Returns:
the parameters object, null if there is not one.
Throws:
CMSException - if the algorithm cannot be found, or the parameters can't be parsed.

getContentFromSessionKey

protected CMSTypedStream getContentFromSessionKey(java.security.Key sKey,
                                                  java.security.Provider provider)
                                           throws CMSException
Throws:
CMSException

getContent

public byte[] getContent(java.security.Key key,
                         java.lang.String provider)
                  throws CMSException,
                         java.security.NoSuchProviderException
Deprecated. use getContent(Recipient)

Throws:
CMSException
java.security.NoSuchProviderException

getContent

public byte[] getContent(java.security.Key key,
                         java.security.Provider provider)
                  throws CMSException
Deprecated. use getContent(Recipient)

Throws:
CMSException

getContentDigest

public byte[] getContentDigest()
Return the content digest calculated during the read of the content if one has been generated. This will only happen if we are dealing with authenticated data and authenticated attributes are present.

Returns:
byte array containing the digest.

getMac

public byte[] getMac()
Return the MAC calculated for the recipient. Note: this call is only meaningful once all the content has been read.

Returns:
byte array containing the mac.

getContent

public byte[] getContent(Recipient recipient)
                  throws CMSException
Return the decrypted/encapsulated content in the EnvelopedData after recovering the content encryption/MAC key using the passed in Recipient.

Parameters:
recipient - recipient object to use to recover content encryption key
Returns:
the content inside the EnvelopedData this RecipientInformation is associated with.
Throws:
CMSException - if the content-encryption/MAC key cannot be recovered.

getContentStream

public CMSTypedStream getContentStream(java.security.Key key,
                                       java.lang.String provider)
                                throws CMSException,
                                       java.security.NoSuchProviderException
Deprecated. use getContentStream(Recipient) method

decrypt the content and return it

Throws:
CMSException
java.security.NoSuchProviderException

getContentStream

public abstract CMSTypedStream getContentStream(java.security.Key key,
                                                java.security.Provider provider)
                                         throws CMSException
Deprecated. use getContentStream(Recipient) method

decrypt the content and return it

Throws:
CMSException

getContentStream

public CMSTypedStream getContentStream(Recipient recipient)
                                throws CMSException,
                                       java.io.IOException
Return a CMSTypedStream representing the content in the EnvelopedData after recovering the content encryption/MAC key using the passed in Recipient.

Parameters:
recipient - recipient object to use to recover content encryption key
Returns:
the content inside the EnvelopedData this RecipientInformation is associated with.
Throws:
CMSException - if the content-encryption/MAC key cannot be recovered.
java.io.IOException

getRecipientOperator

protected abstract RecipientOperator getRecipientOperator(Recipient recipient)
                                                   throws CMSException,
                                                          java.io.IOException
Throws:
CMSException
java.io.IOException

Bouncy Castle Cryptography 1.46