Overview | Package | Class | Tree | Deprecated | Index | Help
| JSS 3.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mozilla.jss.pkix.cms
Class EncryptedContentInfo

    java.lang.Object
      |
      +--org.mozilla.jss.pkix.cms.EncryptedContentInfo

All Implemented Interfaces:
  ASN1Value

public class EncryptedContentInfo
extends java.lang.Object
implements ASN1Value

The PKCS #7 type EncryptedContentInfo, which encapsulates encrypted data.

Nested Class Summary
`static class` | `EncryptedContentInfo.Template` A template file for decoding a EnvelopedData blob

Field Summary
`private AlgorithmIdentifier` | `contentEncryptionAlgorithm`
`private OBJECT_IDENTIFIER` | `contentType`
`private OCTET_STRING` | `encryptedContent`
`private SEQUENCE` | `sequence`
`private static Tag` | `TAG`
`private static EncryptedContentInfo.Template` | `templateInstance`

Constructor Summary
`private` | `EncryptedContentInfo()`
`` | `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 EncryptedContentInfo` | `createCRSCompatibleEncryptedContentInfo(OBJECT_IDENTIFIER contentType, AlgorithmIdentifier contentEncryptionAlgorithm, OCTET_STRING encryptedContent)`
`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.
`byte[]` | `decrypt(Password pass, KeyGenerator.CharToByteConverter charToByteConverter)` Decrypts the content of an EncryptedContentInfo encrypted with a PBE key.
`void` | `encode(java.io.OutputStream ostream)` Write this value's DER encoding to an output stream using its own base tag.
`void` | `encode(Tag tag, java.io.OutputStream ostream)` Write this value's DER encoding to an output stream using an implicit tag.
`AlgorithmIdentifier` | `getContentEncryptionAlgorithm()`
`OBJECT_IDENTIFIER` | `getContentType()`
`OCTET_STRING` | `getEncryptedContent()`
`Tag` | `getTag()` Returns the base tag for this type, not counting any tags that may be imposed on it by its context.
`static EncryptedContentInfo.Template` | `getTemplate()`
`boolean` | `hasEncryptedContent()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### contentType

    private OBJECT_IDENTIFIER contentType

### contentEncryptionAlgorithm

    private AlgorithmIdentifier contentEncryptionAlgorithm

### encryptedContent

    private OCTET_STRING encryptedContent

### sequence

    private SEQUENCE sequence

### TAG

    private static final Tag TAG

### templateInstance

    private static final EncryptedContentInfo.Template templateInstance

Constructor Detail

### EncryptedContentInfo

    private EncryptedContentInfo()

### 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

### getContentType

    public OBJECT_IDENTIFIER getContentType()

### getContentEncryptionAlgorithm

    public AlgorithmIdentifier getContentEncryptionAlgorithm()

### getEncryptedContent

    public OCTET_STRING getEncryptedContent()

### hasEncryptedContent

    public boolean hasEncryptedContent()

### 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)
                                          throws CryptoManager.NotInitializedException,
                                                 java.security.NoSuchAlgorithmException,
                                                 java.security.InvalidKeyException,
                                                 java.security.InvalidAlgorithmParameterException,
                                                 TokenException,
                                                 java.io.CharConversionException

  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.
    `CryptoManager.NotInitializedException`
    `java.security.NoSuchAlgorithmException`
    `java.security.InvalidKeyException`
    `java.security.InvalidAlgorithmParameterException`
    `TokenException`
    `java.io.CharConversionException`

### decrypt

    public byte[] decrypt(Password pass,
                          KeyGenerator.CharToByteConverter charToByteConverter)
                   throws java.lang.IllegalStateException,
                          CryptoManager.NotInitializedException,
                          java.security.NoSuchAlgorithmException,
                          InvalidBERException,
                          java.io.IOException,
                          java.security.InvalidKeyException,
                          java.security.InvalidAlgorithmParameterException,
                          TokenException,
                          IllegalBlockSizeException,
                          BadPaddingException

  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.
    `java.lang.IllegalStateException`
    `CryptoManager.NotInitializedException`
    `java.security.NoSuchAlgorithmException`
    `InvalidBERException`
    `java.io.IOException`
    `java.security.InvalidKeyException`
    `java.security.InvalidAlgorithmParameterException`
    `TokenException`
    `IllegalBlockSizeException`
    `BadPaddingException`

### getTag

    public Tag getTag()

  Description copied from interface: `ASN1Value`
  Returns the base tag for this type, not counting any tags that may be imposed on it by its context.

  Specified by:
    `getTag` in interface `ASN1Value`

### encode

    public void encode(java.io.OutputStream ostream)
                throws java.io.IOException

  Description copied from interface: `ASN1Value`
  Write this value's DER encoding to an output stream using its own base tag.

  Specified by:
    `encode` in interface `ASN1Value`
    `java.io.IOException`

### encode

    public void encode(Tag tag,
                       java.io.OutputStream ostream)
                throws java.io.IOException

  Description copied from interface: `ASN1Value`
  Write this value's DER encoding to an output stream using an implicit tag.

  Specified by:
    `encode` in interface `ASN1Value`
    `java.io.IOException`

### getTemplate

    public static EncryptedContentInfo.Template getTemplate()

Overview | Package | Class | Tree | Deprecated | Index | Help
| JSS 3.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD