org.mozilla.jss.pkix.cms

Class EncryptedContentInfo

public class EncryptedContentInfo extends Object implements ASN1Value

The PKCS #7 type EncryptedContentInfo, which encapsulates encrypted data.
Nested Class Summary
static classEncryptedContentInfo.Template
A template file for decoding a EnvelopedData blob
Constructor Summary
EncryptedContentInfo(OBJECT_IDENTIFIER contentType, AlgorithmIdentifier contentEncryptionAlgorithm, OCTET_STRING encryptedContent)
Create a EnvelopedData ASN1 object.
EncryptedContentInfo(OBJECT_IDENTIFIER contentType, AlgorithmIdentifier contentEncryptionAlgorithm, OCTET_STRING encryptedContent, boolean createHackedCRSCompatibleECI)
Method Summary
static EncryptedContentInfocreateCRSCompatibleEncryptedContentInfo(OBJECT_IDENTIFIER contentType, AlgorithmIdentifier contentEncryptionAlgorithm, OCTET_STRING encryptedContent)
static EncryptedContentInfocreatePBE(PBEAlgorithm keyGenAlg, Password password, byte[] salt, int iterationCount, KeyGenerator.CharToByteConverter charToByteConverter, byte[] toBeEncrypted)
Creates a new EncryptedContentInfo, where the data is encrypted with a password-based key.
byte[]decrypt(Password pass, KeyGenerator.CharToByteConverter charToByteConverter)
Decrypts the content of an EncryptedContentInfo encrypted with a PBE key.
voidencode(OutputStream ostream)
voidencode(Tag tag, OutputStream ostream)
AlgorithmIdentifiergetContentEncryptionAlgorithm()
OBJECT_IDENTIFIERgetContentType()
OCTET_STRINGgetEncryptedContent()
TaggetTag()
static EncryptedContentInfo.TemplategetTemplate()
booleanhasEncryptedContent()

Constructor Detail

EncryptedContentInfo

public EncryptedContentInfo(OBJECT_IDENTIFIER contentType, AlgorithmIdentifier contentEncryptionAlgorithm, OCTET_STRING encryptedContent)
Create a EnvelopedData ASN1 object.

EncryptedContentInfo

public EncryptedContentInfo(OBJECT_IDENTIFIER contentType, AlgorithmIdentifier contentEncryptionAlgorithm, OCTET_STRING encryptedContent, boolean createHackedCRSCompatibleECI)

Method Detail

createCRSCompatibleEncryptedContentInfo

public static EncryptedContentInfo createCRSCompatibleEncryptedContentInfo(OBJECT_IDENTIFIER contentType, AlgorithmIdentifier contentEncryptionAlgorithm, OCTET_STRING encryptedContent)

createPBE

public static EncryptedContentInfo createPBE(PBEAlgorithm keyGenAlg, Password password, byte[] salt, int iterationCount, KeyGenerator.CharToByteConverter charToByteConverter, byte[] toBeEncrypted)
Creates a new EncryptedContentInfo, where the data is encrypted with a password-based key.

Parameters: keyGenAlg The algorithm for generating a symmetric key from a password, salt, and iteration count. password The password to use in generating the key. salt The salt to use in generating the key. iterationCount The number of hashing iterations to perform while generating the key. charToByteConverter The mechanism for converting the characters in the password into bytes. If null, the default mechanism will be used, which is UTF8. toBeEncrypted The bytes to be encrypted and stored in the EncryptedContentInfo. Before they are encrypted, they will be padded using PKCS padding.

decrypt

public byte[] decrypt(Password pass, KeyGenerator.CharToByteConverter charToByteConverter)
Decrypts the content of an EncryptedContentInfo encrypted with a PBE key.

Parameters: pass The password to use in generating the PBE decryption key. charToByteConverter The converter for converting the password characters into bytes. May be null to use the default.

Returns: The decrypted contents of the EncryptedContentInfo. The contents are first unpadded using the PKCS padding mechanism.

encode

public void encode(OutputStream ostream)

encode

public void encode(Tag tag, OutputStream ostream)

getContentEncryptionAlgorithm

public AlgorithmIdentifier getContentEncryptionAlgorithm()

getContentType

public OBJECT_IDENTIFIER getContentType()

getEncryptedContent

public OCTET_STRING getEncryptedContent()

getTag

public Tag getTag()

getTemplate

public static EncryptedContentInfo.Template getTemplate()

hasEncryptedContent

public boolean hasEncryptedContent()