|
XCMS Toolkit | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.cms.crypto.EncryptedDataProcessor
public class EncryptedDataProcessor
Creates EncryptedData objects using a symmetrical
encryption algorithm and a secret Content Encryption Key (CEK).
Supports the creation of "detached" EncryptedData,
by providing methods to create values of ASN.1 type EncryptedData
whose encryptedContentInfo component contains no encrypted content,
and to seperately encrypt the content.
Decrypts the encrypted content of values of ASN.1 type
EncryptedData, or detached content associated with
EncryptedData values.
ASN.1 type EncryptedData is defined in ISO 22895 as:
EncryptedData ::= SEQUENCE {
version CMSVersion,
encryptedContentInfo EncryptedContentInfo,
unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL
}
EncryptedContentInfo ::= SEQUENCE {
contentType ContentType,
contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier,
encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL
}
ContentType ::= CONTENTS.&id({Contents}) -- OBJECT IDENTIFIER
ContentEncryptionAlgorithmIdentifier ::= SEQUENCE {
algorithm ALGORITHM.&id({ContentEncryptionAlgorithms}),
parameters ALGORITHM.&Type({ContentEncryptionAlgorithms}{@algorithm}) OPTIONAL
}
ContentEncryptionAlgorithms ALGORITHM ::= {
... -- Expect additional objects --
}
EncryptedContent ::= OCTET STRING
| Constructor Summary | |
|---|---|
EncryptedDataProcessor(CMSVersion version,
Codec codec)
Constructor for EncryptedDataProcessor with initialization
parameters for the syntax version of ASN.1 type EncryptedData
and the ASN.1 encoding rules to be used for encoding and decoding values. |
|
| Method Summary | |
|---|---|
EncryptedData |
createDetached(ContentType contentType,
ContentEncryptionAlgorithmIdentifier algorithm,
UnprotectedAttributes unprotectedAttributes)
Creates a value of ASN.1 type EncryptedData whose encrypted
content is "detached", and not present in the value of ASN.1 type
EncryptedContentInfo message component. |
byte[] |
decrypt(byte[] ciphertext,
EncryptedData encryptedData,
javax.crypto.SecretKey key)
Decrypts ciphertext associated with a value of ASN.1 type EncryptedData in which the optional
encryptedContent component of ASN.1 type
EncryptedContentInfois absent in the
EncryptedData value, and must be provided by
the caller. |
byte[] |
decrypt(EncryptedData encryptedData,
javax.crypto.SecretKey key)
Decrypts a value of ASN.1 type EncryptedData in
which the optional encryptedContent component of
ASN.1 type EncryptedContentInfois present in the
EncryptedData value. |
EncryptedData |
encrypt(byte[] content,
ContentType contentType,
ContentEncryptionAlgorithmIdentifier algorithm,
javax.crypto.SecretKey key,
UnprotectedAttributes unprotectedAttributes)
Creates a value of ASN.1 type EncryptedData whose
encrypted content is present in the value of its ASN.1 type
EncryptedContentInfo message component. |
byte[] |
encryptDetached(byte[] content,
ContentEncryptionAlgorithmIdentifier algorithm,
javax.crypto.SecretKey key)
Encrypts the detached content of a value of ASN.1 type EncryptedData using the specified content encryption
algorithm and the provided secret Content Encryption Key CEK),
and returns the ciphertext results of encrypting the content
to the caller. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public EncryptedDataProcessor(CMSVersion version,
Codec codec)
EncryptedDataProcessor with initialization
parameters for the syntax version of ASN.1 type EncryptedData
and the ASN.1 encoding rules to be used for encoding and decoding values.
version - syntax version of ASN.1 type EncryptedDatacodec - ASN.1 encoding rules to be used for encoding and decoding| Method Detail |
|---|
public EncryptedData encrypt(byte[] content,
ContentType contentType,
ContentEncryptionAlgorithmIdentifier algorithm,
javax.crypto.SecretKey key,
UnprotectedAttributes unprotectedAttributes)
throws CryptoException
EncryptedData whose
encrypted content is present in the value of its ASN.1 type
EncryptedContentInfo message component.
Encrypts the data to be encrypted (content) using the encryption algorithm
and any associated parameters, and a secret Content Encryption Key (CEK).
The content to be encrypted may be ordinary data, or one of the CMS types
supported by this toolkit, such as SignedData.
Returns an EncryptedData object that contains the encrypted
content.
content - data to be encryptedcontentType - the CMS type of content to be encrypted (Data,
NamedKeyEncryptedData, SignedData, etc.)algorithm - encryption algorithm and any associated parameterskey - secret key compatible with the specified encryption algorithmunprotectedAttributes - attributes that are not part of the cryptographic
message, that get transferred in the message
EncryptedData
CryptoException
public byte[] decrypt(EncryptedData encryptedData,
javax.crypto.SecretKey key)
throws CryptoException,
EncodingException
EncryptedData in
which the optional encryptedContent component of
ASN.1 type EncryptedContentInfois present in the
EncryptedData value.
encryptedData - the CMS type whose encrypted content is to be decryptedkey - the secret key that was employed to encrypt the content
null if the content is not present
CryptoException
EncodingException
public EncryptedData createDetached(ContentType contentType,
ContentEncryptionAlgorithmIdentifier algorithm,
UnprotectedAttributes unprotectedAttributes)
throws CryptoException
EncryptedData whose encrypted
content is "detached", and not present in the value of ASN.1 type
EncryptedContentInfo message component.
contentType - the CMS type of content to be encrypted (Data, NamedKeyEncryptedData, DigestedData, etc.)algorithm - encryption algorithm and any associated parametersunprotectedAttributes - attributes that are not part of the cryptographic
message, that get transferred in the message
EncryptedData that does NOT contain encrypted content
CryptoException
public byte[] encryptDetached(byte[] content,
ContentEncryptionAlgorithmIdentifier algorithm,
javax.crypto.SecretKey key)
throws CryptoException
EncryptedData using the specified content encryption
algorithm and the provided secret Content Encryption Key CEK),
and returns the ciphertext results of encrypting the content
to the caller.
content - data to be encryptedalgorithm - encryption algorithm and any associated parameterskey - secret key compatible with the specified encryption algorithm
content
using the specified content encryption algorithm and provided Content Encryption Key (CEK)
CryptoException
public byte[] decrypt(byte[] ciphertext,
EncryptedData encryptedData,
javax.crypto.SecretKey key)
throws CryptoException,
EncodingException
EncryptedData in which the optional
encryptedContent component of ASN.1 type
EncryptedContentInfois absent in the
EncryptedData value, and must be provided by
the caller.
ciphertext - the detached encrypted contentencryptedData - the CMS type whose encrypted content is to be decryptedkey - the secret key that was employed to encrypt the content
CryptoException
EncodingException
|
XCMS Toolkit | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||