|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.rsa.certj.pkcs7.ContentInfo | +--com.rsa.certj.pkcs7.EncryptedData
This class encodes and decodes the PKCS #7
EncryptedData
type. The encrypted-data
content type consists of encrypted content of any type.
Unlike the enveloped-data content type,
the encrypted-data content type has neither recipients
nor encrypted content-encryption keys. Keys are assumed
to be managed by other means. The
typical application of the encrypted-data content type
is expected to encrypt content of the data-content type for
local storage, perhaps where the encryption key is a
password.
EncryptedData ::= SEQUENCE { version Version, encryptedContentInfo EncryptedContentInfo } EncryptedContentInfo ::= SEQUENCE { contentType ContentType, contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier, encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL } |
EncryptedData
have the following
meanings:
zero
for this version of the
standard.EncryptedContentInfo
have
the following meanings:
See Also
Fields inherited from class com.rsa.certj.pkcs7.ContentInfo |
DATA, DIGESTED_DATA, ENCRYPTED_DATA, ENVELOPED_DATA, NO_CONTENT, PKCS7_VERSION_NUMBER_0, PKCS7_VERSION_NUMBER_1, SIGNED_DATA |
Constructor Summary |
|
EncryptedData(CertJ certJ,
CertPathCtx pathCtx)
Creates a new object to encode or decode the PKCS #7
|
Method Summary |
|
void |
clearSensitiveData()
Clears any sensitive data. |
clone()
Overrides the default |
|
boolean |
equals(Object obj)
Returns |
getEncryptionAlgorithmName()
Gets Gets the content-encryption algorithm name,
for example, |
|
byte[] |
getEncryptionAlgorithmOID()
Gets the content-encryption algorithm OID. |
byte[] |
getIV()
Gets the initialization vector (IV). |
char[] |
getPassword()
Gets the password data. |
byte[] |
getSalt()
Gets the salt data for the password-based encryption (PBE). |
com.rsa.jsafe.JSAFE_SecretKey |
getSecretKey()
Gets the secret key. |
byte[] |
getSecretKeyData()
Gets the secret key data. |
int |
getVersionNumber()
Gets the PKCS #7 syntax version number. |
void |
setContentInfo(ContentInfo content)
Sets the actual content data of this |
void |
setEncryptionAlgorithm(byte[] oid,
int offset,
int len)
Sets content-encryption algorithm ID. |
void |
setEncryptionAlgorithm(String algName)
Sets the content-encryption algorithm,
for example, |
void |
setIV(byte[] iv,
int offset,
int len)
Sets the initialization vector (IV) to the first len bytes of iv, beginning at offset. |
void |
setPassword(char[] password,
int offset,
int len)
Sets the password to the len characters of password, beginning at offset. |
void |
setSalt(byte[] salt,
int offset,
int len)
Sets the salt data for password-based encryption (PBE) to the first len bytes of salt, beginning at offset. |
void |
setSecretKey(com.rsa.jsafe.JSAFE_SecretKey key)
Sets the secret key. |
void |
setSecretKeyData(byte[] keyData,
int offset,
int len)
Sets the secret key data to the len bytes of keyData, beginning at offset. |
void |
setVersionNumber(int versionNumber)
Sets the PKCS #7 syntax version number. |
Methods inherited from class com.rsa.certj.pkcs7.ContentInfo |
bytesRead, clearInternalContentBuffer, endOfMessage, getContent, getContentInfoDERLen, getContentInfoDERLen, getContentType, getDevice, getDeviceList, getInstance, getInstance, getMessageType, getMessageType, getUnprocessedDataLen, readFinal, readInit, readInit, readInit, readUpdate, setCertJ, setCertPath, setDevice, writeMessage, writeMessage |
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public EncryptedData(CertJ certJ, CertPathCtx pathCtx)
EncryptedData
.Parameters
certJ | A | ||
pathCtx | A |
Method Detail |
public void setVersionNumber(int versionNumber)
Parameters
versionNumber | The PKCS #7 syntax version number. |
public int getVersionNumber()
Returns
public void setIV(byte[] iv, int offset, int len)
Parameters
iv | A | ||
offset | The offset into the iv array. | ||
len | The length of the IV data in the iv array. |
public byte[] getIV()
Returns
byte
array containg the
IV data. If the IV is not set,
this method returns null
.public void setSalt(byte[] salt, int offset, int len)
Parameters
salt | A | ||
offset | The offset into salt. | ||
len | The length of the PBE salt data in salt. |
public byte[] getSalt()
Returns
byte
array that contains PBE salt data.
If the salt data is not set, this method returns null
.public void setEncryptionAlgorithm(String algName) throws PKCS7Exception
DES/ECB/NoPad
.
If you pass in trasformation that does not have defined OID,
this method will throw an exception,
for example DES/ECB/PKCS5Padding
.
Parameters
algName | The content-encryption algorithm |
Throws
PKCS7Exception
- If algName is
null
or invalid.public void setEncryptionAlgorithm(byte[] oid, int offset, int len) throws PKCS7Exception
Parameters
oid | Identifies the content-encryption algorithm (and any associated parameters) under which the content is encrypted. | ||
offset | The offset into oid where the algorithm begins. | ||
len | The length of the data in oid, |
Throws
PKCS7Exception
- If the specified OID data
is null
.public byte[] getEncryptionAlgorithmOID()
Returns
public String getEncryptionAlgorithmName() throws PKCS7Exception
DES/ECB/NoPad
.
Returns
ContentEncryptionAlgorithm
name.public void setSecretKey(com.rsa.jsafe.JSAFE_SecretKey key) throws PKCS7Exception
JSAFE_SecretKey
.Parameters
key | A |
Throws
PKCS7Exception
- If this key cannot be set or
if the key is null
.public com.rsa.jsafe.JSAFE_SecretKey getSecretKey() throws PKCS7Exception
Returns
Throws
PKCS7Exception
- If the key cannot be obtained.public void setSecretKeyData(byte[] keyData, int offset, int len) throws PKCS7Exception
Parameters
keyData | A | ||
offset | Tthe offset into keyData. | ||
len | The length of the secret key data in keyData. |
Throws
PKCS7Exception
- The specified
key data is null
,
the encryption algorithm is not set, or the specified key
data is invalid for the specified encryption algorithm.public byte[] getSecretKeyData()
Returns
byte
array that contains the secret
key data. If the secret key is not set, this method
returns null
.public void setPassword(char[] password, int offset, int len)
setSecretKeyData
. See the Crypto-J User Manual
for more information about password.Parameters
password | The password data. | ||
offset | The offset into password where the password data begins. | ||
len | The length of the password data. |
public char[] getPassword() throws PKCS7Exception
Returns
char
array that contains the password data.Throws
PKCS7Exception
- If the object is not set with a password.public void setContentInfo(ContentInfo content) throws PKCS7Exception
EncryptedData
object.Parameters
content | The |
Throws
PKCS7Exception
- If content cannot be cloned
or if it is null
.public Object clone() throws CloneNotSupportedException
clone
method
to get a deeper clone.
Overrides
clone
in class ContentInfo
Returns
Throws
CloneNotSupportedException
- If the cloning operation
is not successful.public boolean equals(Object obj)
true
if this object
and obj contain the same
EncryptedData
;
returns false
otherwise.Overrides
equals
in class Object
Parameters
obj | An instance of the
|
Returns
boolean
indicating whether
these objects are equal.public void clearSensitiveData()
finalizer
will clear
the data, but it is not known when the garbage collector will call the
finalizer
. This method clears all sensitive data as soon
as possible.
Overrides
clearSensitiveData
in class ContentInfo
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |