All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class iaik.pkcs.EncryptedContentInfo

java.lang.Object
   |
   +----iaik.pkcs.EncryptedContentInfo

public class EncryptedContentInfo
extends Object
This class implements the PKCS#7 EncryptedContentInfo type.


Constructor Index

 o EncryptedContentInfo(ASN1Object)
Create an EncryptedContentInfo from an ASN1Object.
 o EncryptedContentInfo(ObjectID, AlgorithmID)
Create an EncryptedContentInfo with a content type and an encryption algorithm.
 o EncryptedContentInfo(ObjectID, AlgorithmID, byte[])
Create an EncryptedContentInfo form already encrypted data.
 o EncryptedContentInfo(PKCS7ContentInfo)
Creates an EncryptedContentInfo from a ContentInfo and an AlgorithmID.

Method Index

 o decrypt(Key)
Use the specified key to decrypt the content of this object.
 o encrypt()
Create a new randon key and encrypt the content of this object.
 o encrypt(Key, AlgorithmID)
Use the specified key to encrypt the content of this object.
 o getContentEncryptionAlgorithm()
 o getContentType()
 o getEncryptedContent()
 o hasContent()
 o toASN1Object()
Returns the EncryptedContentInfo as ASN1Object.
 o toString()
Returns a string that represents the contents of the extensions.

Constructors

 o EncryptedContentInfo
 public EncryptedContentInfo(PKCS7ContentInfo contentInfo) throws PKCSException
Creates an EncryptedContentInfo from a ContentInfo and an AlgorithmID. To finish the creation one of the encrypt methods must be called.

Parameters:
contentInfo - the PKCS#7 ContentInfo to encrypt
 o EncryptedContentInfo
 public EncryptedContentInfo(ObjectID contentType,
                             AlgorithmID contentEncAlg,
                             byte encryptedContent[])
Create an EncryptedContentInfo form already encrypted data. The content is already encrypted and this class is only used for doing the ASN.1 encoding.

Parameters:
contentType - the type of the encrypted content
contentEncAlg - the algorithm used to encrypt the content
encryptedContent - the encrypted content as byte array
 o EncryptedContentInfo
 public EncryptedContentInfo(ObjectID contentType,
                             AlgorithmID contentEncAlg)
Create an EncryptedContentInfo with a content type and an encryption algorithm. The encrypted data is transported in another way.

Parameters:
contentType - the type of the encrypted content
contentEncAlg - the algorithm used to encrypt the content
 o EncryptedContentInfo
 public EncryptedContentInfo(ASN1Object obj) throws CodingException
Create an EncryptedContentInfo from an ASN1Object.

Parameters:
obj - the ASN1Object of ASN.1 type EncryptedContentInfo
Throws: CodingException
if the ASN.1 object could not be parsed

Methods

 o decrypt
 public PKCS7ContentInfo decrypt(Key key) throws NoSuchAlgorithmException, KeyException, PKCSException
Use the specified key to decrypt the content of this object.

Parameters:
key - the key to decrypt the content
Returns:
the decrypted content
Throws: NoSuchAlgorithmException
if there is no implementation for the contentEncryptionAlg
Throws: KeyException
if there is a problem with the key
Throws: PKCSException
if there is problem with the PKCS#7 format, ...
 o encrypt
 public void encrypt(Key key,
                     AlgorithmID contentEncryptionAlg) throws NoSuchAlgorithmException, KeyException
Use the specified key to encrypt the content of this object.

Parameters:
key - the key to decrypt the content
contentEncAlg - the algorithm to encrypt the content
Throws: NoSuchAlgorithmException
if there is no implementation for the contentEncryptionAlg
Throws: KeyException
if there is a problem with the key
 o encrypt
 public Key encrypt()
Create a new randon key and encrypt the content of this object.

Returns:
the created key
 o toASN1Object
 public ASN1Object toASN1Object()
Returns the EncryptedContentInfo as ASN1Object.

Returns:
the EncryptedContentInfo as ASN1Object
 o getContentType
 public ObjectID getContentType()
 o getContentEncryptionAlgorithm
 public AlgorithmID getContentEncryptionAlgorithm()
 o getEncryptedContent
 public byte[] getEncryptedContent()
 o hasContent
 public boolean hasContent()
 o toString
 public String toString()
Returns a string that represents the contents of the extensions.

Returns:
the string representation
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index