|
XCMS Toolkit | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.cms.crypto.NamedKeyEncryptedDataProcessor
public class NamedKeyEncryptedDataProcessor
Creates a NamedKeyEncryptedData object using a symmetrical
encryption algorithm and a secret key. Decrypts the contents of
NamedKeyEncryptedData.
ASN.1 type NamedKeyEncryptedData is defined in ISO 22895
Cryptographic Syntax Scheme as:
NamedKeyEncryptedData ::= SEQUENCE {
version CMSVersion,
keyName [0] OCTET STRING (SIZE(1..MAX)) OPTIONAL,
encryptedContentInfo EncryptedContentInfo,
unprotectedAttrs [1] UnprotectedAttributes OPTIONAL
}
EncryptedContentInfo ::= SEQUENCE {
contentType ContentType,
contentEncryptionAlgorithm ContentEncryptAlgorithmIdentifier,
encryptedContent [0] EncryptedContent OPTIONAL
}
UnprotectedAttributes ::= SET SIZE(1..MAX) OF Attribute {{Unprotected}}
Unprotected ATTRIBUTE ::= {
... -- Expect additional objects --
}
Attribute { ATTRIBUTE:IOSet } ::= SEQUENCE {
attrType ATTRIBUTE.&id({IOSet}),
atrValues SET OF ATTRIBUTE.&Type({IOSet}{@type})
}
| Constructor Summary | |
|---|---|
NamedKeyEncryptedDataProcessor(CMSVersion version,
Codec codec)
Constructor for NamedKeyEncryptedDataProcessor with
initialization parameters for the syntax version of ASN.1 type
NamedKeyEncryptedData and the ASN.1 encoding rules
to be used for encoding and decoding values. |
|
| Method Summary | |
|---|---|
NamedKeyEncryptedData |
createDetached(byte[] keyName,
ContentType contentType,
ContentEncryptionAlgorithmIdentifier algorithm,
UnprotectedAttributes unprotectedAttributes)
Creates a value of ASN.1 type NamedKeyEncryptedData whose
encrypted content is "detached", and not present in the value of ASN.1
type EncryptedContentInfo message component. |
byte[] |
decrypt(byte[] ciphertext,
NamedKeyEncryptedData namedKeyEncryptedData,
javax.crypto.SecretKey key)
Decrypts ciphertext associated with a value of ASN.1 type NamedKeyEncryptedData in which the optional
encryptedContent component of ASN.1 type
EncryptedContentInfois absent in the
NamedKeyEncryptedData value, and must be
provided by the caller. |
byte[] |
decrypt(NamedKeyEncryptedData namedKeyEncryptedData,
javax.crypto.SecretKey key)
|
byte[] |
decrypt(NamedKeyEncryptedData namedKeyEncryptedData,
SecretKeyLookup keyLookup)
Decrypts the encrypted payload in a value of CMS type NamedKeyEncryptedData. |
NamedKeyEncryptedData |
encrypt(byte[] content,
byte[] keyName,
ContentType contentType,
ContentEncryptionAlgorithmIdentifier algorithm,
javax.crypto.SecretKey key,
UnprotectedAttributes unprotectedAttributes)
Creates a value of ASN.1 type NamedKeyEncryptedData
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 NamedKeyEncryptedData using the specified content
encryption algorithm and the provided named 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 NamedKeyEncryptedDataProcessor(CMSVersion version,
Codec codec)
NamedKeyEncryptedDataProcessor with
initialization parameters for the syntax version of ASN.1 type
NamedKeyEncryptedData and the ASN.1 encoding rules
to be used for encoding and decoding values.
version - syntax version of ASN.1 type NamedKeyEncryptedDatacodec - ASN.1 encoding rules to be used for encoding and decoding| Method Detail |
|---|
public NamedKeyEncryptedData encrypt(byte[] content,
byte[] keyName,
ContentType contentType,
ContentEncryptionAlgorithmIdentifier algorithm,
javax.crypto.SecretKey key,
UnprotectedAttributes unprotectedAttributes)
throws CryptoException
NamedKeyEncryptedData
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 a NamedKeyEncryptedData object that contains the
encrypted content.
content - data to be encryptedcontentType - the CMS type of content to be encrypted (Data,keyName - a string that identifies the Content Encryption Key (CEK)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
NamedKeyEncryptedData
CryptoException
public byte[] decrypt(NamedKeyEncryptedData namedKeyEncryptedData,
SecretKeyLookup keyLookup)
throws CryptoException
NamedKeyEncryptedData.
namedKeyEncryptedData - a value of ASN.1 type NamedKeyEncryptedData in its encoded formkeyLookup - simulates named key look up facillity
CryptoException
public byte[] decrypt(NamedKeyEncryptedData namedKeyEncryptedData,
javax.crypto.SecretKey key)
throws CryptoException
CryptoException
public NamedKeyEncryptedData createDetached(byte[] keyName,
ContentType contentType,
ContentEncryptionAlgorithmIdentifier algorithm,
UnprotectedAttributes unprotectedAttributes)
throws CryptoException
NamedKeyEncryptedData 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, EncryptedData, DigestedData, etc.)algorithm - encryption algorithm and any associated parametersunprotectedAttributes - attributes that are not part of the cryptographic
message, that get transferred in the message
NamedKeyEncryptedData that does NOT contain encrypted content
CryptoException
public byte[] encryptDetached(byte[] content,
ContentEncryptionAlgorithmIdentifier algorithm,
javax.crypto.SecretKey key)
throws CryptoException
NamedKeyEncryptedData using the specified content
encryption algorithm and the provided named secret Content Encryption
Key CEK), and returns the ciphertext results of encrypting the
content to the caller. Note that the key name is not provided.
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,
NamedKeyEncryptedData namedKeyEncryptedData,
javax.crypto.SecretKey key)
throws CryptoException,
EncodingException
NamedKeyEncryptedData in which the optional
encryptedContent component of ASN.1 type
EncryptedContentInfois absent in the
NamedKeyEncryptedData value, and must be
provided by the caller.
ciphertext - the detached encrypted contentnamedKeyEncryptedData - 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 | ||||||||