|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.security.pkcsutil.PKCSDerObject | +--com.ibm.security.pkcs7.EncryptedContentInfo
Implements the ASN.1 EncryptedContentInfo type specified in PKCS #7 and later in S/MIME-CMS. It is mainly used in EnvelopedData to hold the encrypted content which is encrypted by a symmetric key algorithm. It is also used in PKCS #12 (PFX) to hold a PKCS #12 encryption result.
This implementation reflects PKCS #7 version 1.5 specifications with selected enhancements from the Cryptographic Message Syntax (CMS) RFC 2630 specifications.
EncryptedContentInfo objects are immutable; they cannot be changed once created.
AlgorithmId
Fields inherited from class com.ibm.security.pkcsutil.PKCSDerObject |
provider |
Constructor Summary | |
EncryptedContentInfo(byte[] der)
Create an EncryptedContentInfo object with a DER-encoded byte array. |
|
EncryptedContentInfo(byte[] der,
String provider)
Create an EncryptedContentInfo object with a DER-encoded byte array. |
|
EncryptedContentInfo(ContentInfo cinfo,
String algname,
byte[] key)
Create an EncryptedContentInfo object with the specified contentInfo, encryption algorithm, and key byte array. |
|
EncryptedContentInfo(ContentInfo cinfo,
String algname,
byte[] key,
String provider)
Create an EncryptedContentInfo object with the specified contentInfo, encryption algorithm, and key byte array. |
|
EncryptedContentInfo(ContentInfo cinfo,
String algname,
int keySize)
Create an EncryptedContentInfo object with the specified contentInfo, encryption algorithm, and key size. |
|
EncryptedContentInfo(ContentInfo cinfo,
String algname,
int keySize,
String provider)
Create an EncryptedContentInfo object with the specified contentInfo, encryption algorithm, and key size. |
|
EncryptedContentInfo(ObjectIdentifier contentType,
AlgorithmId contentEncryptionAlg,
byte[] encryptedContent)
Create an EncryptedContentInfo object with the specified values. |
|
EncryptedContentInfo(ObjectIdentifier contentType,
AlgorithmId contentEncryptionAlg,
byte[] encryptedContent,
String provider)
Create an EncryptedContentInfo object with the specified values. |
|
EncryptedContentInfo(String filename,
boolean base64)
Create an EncryptedContentInfo with the filename of the DER-encoded or BASE64-encoded object. |
|
EncryptedContentInfo(String filename,
boolean base64,
String provider)
Create an EncryptedContentInfo with the filename of the DER-encoded or BASE64-encoded object. |
Method Summary | |
Object |
clone()
Creates a clone of this EncryptedContentInfo object. |
protected void |
decode(com.ibm.security.pkcs7.DerValue encoding)
Initializes an EncryptedContentInfo object from a DerValue. |
ContentInfo |
decrypt(byte[] decryptionKey)
Decrypts the object's encrypted content using the input decryption key. |
void |
encode(OutputStream os)
Encodes this object to an OutputStream. |
boolean |
equals(Object other)
Determines if this EncryptedContentInfo object is equivalent to the input object. |
protected void |
finalize()
Ensures that the encryptionKeyBytes bytes are nulled out when there are no more references to this object. |
AlgorithmId |
getContentEncryptionAlgorithm()
Returns a copy of the the encryption algorithm that was used to encrypt the content. |
ObjectIdentifier |
getContentType()
Returns a reference to the ObjectIdentifer for the encrypted content. |
byte[] |
getEncryptedContent()
Returns a copy of the encrypted content. |
byte[] |
getEncryptionKey()
Returns a copy of the key byte array used to encrypt the content, or null if this object was not used to encrypt the content. |
String |
toString()
Returns a string representation of this EncryptedContentInfo object. |
Methods inherited from class com.ibm.security.pkcsutil.PKCSDerObject |
decode,
decode,
encode,
getObjectIdentifier,
hashCode,
read,
readBASE64,
write,
write,
writeBASE64 |
Methods inherited from class java.lang.Object |
getClass,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public EncryptedContentInfo(byte[] der) throws IOException
der
- a byte array containing the DER-encoded encoding of an
EncryptedContentInfo object.public EncryptedContentInfo(byte[] der, String provider) throws IOException
der
- a byte array containing the DER-encoded encoding of anprovider
- the name of the java security provider
EncryptedContentInfo object.public EncryptedContentInfo(ObjectIdentifier contentType, AlgorithmId contentEncryptionAlg, byte[] encryptedContent)
contentType
- the content type of the input encrypted content.contentEncryptionAlg
- specifies the algorithm used to encrypt the
input encrypted content.encryptedContent
- the encrypted content.public EncryptedContentInfo(ObjectIdentifier contentType, AlgorithmId contentEncryptionAlg, byte[] encryptedContent, String provider)
contentType
- the content type of the input encrypted content.contentEncryptionAlg
- specifies the algorithm used to encrypt the
input encrypted content.encryptedContent
- the encrypted content.provider
- the name of the java security providerpublic EncryptedContentInfo(ContentInfo cinfo, String algname, int keySize, String provider) throws PKCSException, IOException
cinfo
- a ContentInfo object containing the content to be encrypted.
Only the content octets are encrypted, not any tag or length information.algname
- the algorithm used to encrypt the content. This may be
just the algorithm used (valid values are DES, DESede and RC2)keySize
- the key size of the encryption key. Valid values are
algorithm-dependent: DES accepts a key size of 56 bits, RC2 accepts
key sizes between 1 and 128 bytes (8 - 128*8 bits) and DESede accepts
key sizes of 112 or 168 bits.provider
- the name of the java security providerpublic EncryptedContentInfo(ContentInfo cinfo, String algname, int keySize) throws PKCSException, IOException
cinfo
- a ContentInfo object containing the content to be encrypted.
Only the content octets are encrypted, not any tag or length information.algname
- the algorithm used to encrypt the content. This may be
just the algorithm used (valid values are DES, DESede and RC2)keySize
- the key size of the encryption key. Valid values are
algorithm-dependent: DES accepts a key size of 56 bits, RC2 accepts
key sizes between 1 and 128 bytes (8 - 128*8 bits) and DESede accepts
key sizes of 112 or 168 bits.public EncryptedContentInfo(ContentInfo cinfo, String algname, byte[] key) throws PKCSException, IOException
cinfo
- a ContentInfo object containing the content to be encrypted.
Only the content octets are encrypted, not any tag or length information.algname
- the algorithm used to encrypt the content. This may be
be just the algorithm used (valid values are DES, DESede and RC2) or a
complete transformation in which the algorithm is one of DES, DESede or
RC2, the mode is CBC and the padding is PKCS5Padding.key
- the key used in the encryption operation; this key must
correspond to the input encryption algorithm.public EncryptedContentInfo(ContentInfo cinfo, String algname, byte[] key, String provider) throws PKCSException, IOException
cinfo
- a ContentInfo object containing the content to be encrypted.
Only the content octets are encrypted, not any tag or length information.algname
- the algorithm used to encrypt the content. This may be
be just the algorithm used (valid values are DES, DESede and RC2) or a
complete transformation in which the algorithm is one of DES, DESede or
RC2, the mode is CBC and the padding is PKCS5Padding.key
- the key used in the encryption operation; this key must
correspond to the input encryption algorithm.provider
- the name of the java security providerpublic EncryptedContentInfo(String filename, boolean base64) throws IOException
filename
- name of the DER-encoded or base64-encoded objectbase64
- true if BASE64-encoded, false if DER-encodedpublic EncryptedContentInfo(String filename, boolean base64, String provider) throws IOException
filename
- name of the DER-encoded or base64-encoded objectbase64
- true if BASE64-encoded, false if DER-encodedprovider
- the name of the java security provider to useMethod Detail |
public void encode(OutputStream os) throws IOException
os
- the OutputStream to write the encoded data to.protected void decode(com.ibm.security.pkcs7.DerValue encoding) throws IOException
encoding
- a DER-encoded EncryptedContentInfo object.public boolean equals(Object other)
other
- the object to compare this one to.public String toString()
public ContentInfo decrypt(byte[] decryptionKey) throws IOException, PKCSException
decryptionKey
- a byte encoding of the key to use for content
decryption.public AlgorithmId getContentEncryptionAlgorithm() throws IOException
public ObjectIdentifier getContentType()
public byte[] getEncryptedContent()
public Object clone()
public byte[] getEncryptionKey()
protected void finalize()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |