|
|||||||||
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.RecipientInfo
Implements the ASN.1 RecipientInfo type. It is specified in PKCS #7 and was later refined in S/MIME.
This class contains per-recipient information in a Certificate, for example, the version number, the issuer and issuer serial number, the key encryption algorithm ID and the encrypted session key.
PKCS #7 defines RecipientInfo as follows:
S/MIME defines RecipientInfo as follows:
S/MIME also defines the following types:
RecipientInfo objects are immutable; they cannot be changed once created.
RecipientIdentifier
,
EntityIdentifier
,
AlgorithmId
Fields inherited from class com.ibm.security.pkcsutil.PKCSDerObject |
provider |
Constructor Summary | |
RecipientInfo(byte[] der)
Create a RecipientInfo object with a DER-encoded byte array. |
|
RecipientInfo(byte[] key,
Certificate cert)
Create a RecipientInfo object with the specified key and certificate. |
|
RecipientInfo(byte[] key,
Certificate cert,
String provider)
Create a RecipientInfo object with the specified key and certificate. |
|
RecipientInfo(byte[] der,
String provider)
Create a RecipientInfo object with a DER-encoded byte array. |
|
RecipientInfo(RecipientIdentifier rid,
EntityIdentifier ei,
AlgorithmId alg,
byte[] key)
Create a RecipientInfo object with the specified values. |
|
RecipientInfo(RecipientIdentifier rid,
EntityIdentifier ei,
AlgorithmId alg,
byte[] key,
String provider)
Create a RecipientInfo object with the specified values. |
|
RecipientInfo(String filename,
boolean base64)
Create a RecipientInfo with the filename of the DER-encoded or BASE64-encoded object. |
|
RecipientInfo(String filename,
boolean base64,
String provider)
Create a RecipientInfo with the filename of the DER-encoded or BASE64-encoded object. |
Method Summary | |
Object |
clone()
Creates a clone of this RecipientInfo object. |
protected void |
decode(com.ibm.security.pkcs7.DerValue encoding)
Initializes a RecipientInfo object from a DerValue. |
byte[] |
decryptKey(PrivateKey key)
Decrypts the encrypted symmetric key with the input private key. |
void |
encode(OutputStream os)
Encodes this object to an OutputStream. |
boolean |
equals(Object other)
Determines if this RecipientInfo object is equivalent to the input object. |
protected void |
finalize()
Ensures that the encryptedKey bytes are nulled out when there are no more references to this object. |
byte[] |
getEncryptedKey()
Returns a copy of the symmetric key which was encrypted with the public key of this recipient. |
EntityIdentifier |
getEntityIdentifier()
Returns a copy of the EntityIdentifier. |
AlgorithmId |
getKeyEncryptionAlgorithm()
Returns a copy of the algorithm, represented as an AlgorithmId, that was used to encrypt the symmetric key. |
RecipientIdentifier |
getRecipientIdentifier()
Returns a copy of the RecipientIdentifier. |
BigInteger |
getVersion()
Returns the syntax version number of this RecipientInfo object. |
boolean |
identifies(Certificate cert)
Determines if the recipient represented by this object is identified by the input certificate. |
String |
toString()
Returns a string representation of this RecipientInfo 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 RecipientInfo(byte[] der) throws IOException
der
- a byte array containing the DER-encoded encoding of a RecipientInfo
object.public RecipientInfo(byte[] der, String provider) throws IOException
der
- a byte array containing the DER-encoded encoding of a RecipientInfo
object.provider
- the name of the java security provider to usepublic RecipientInfo(byte[] key, Certificate cert) throws IOException, PKCSException
key
- the encoded symmetric key to be encrypted with the
recipient's public key.cert
- the X.509 certificate containing the recipient's identity
and public key.public RecipientInfo(byte[] key, Certificate cert, String provider) throws IOException, PKCSException
key
- the encoded symmetric key to be encrypted with the
recipient's public key.cert
- the X.509 certificate containing the recipient's identity
and public key.provider
- the name of the java security provider to usepublic RecipientInfo(RecipientIdentifier rid, EntityIdentifier ei, AlgorithmId alg, byte[] key)
rid
- RecipientIdentifierei
- EntityIdentifieralg
- key encryption algorithmkey
- encrypted secret key bytespublic RecipientInfo(RecipientIdentifier rid, EntityIdentifier ei, AlgorithmId alg, byte[] key, String provider)
rid
- RecipientIdentifierei
- EntityIdentifieralg
- key encryption algorithmkey
- encrypted secret key bytesprovider
- the name of the java security provider to usepublic RecipientInfo(String filename, boolean base64) throws IOException
filename
- name of the DER-encoded or base64-encoded objectbase64
- true if BASE64-encoded, false if DER-encodedpublic RecipientInfo(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 RecipientInfo object.public boolean equals(Object other)
other
- the object to compare this one to.public String toString()
public Object clone()
public BigInteger getVersion()
This method returns a reference to the BigInteger version. BigInteger is an immutable object.
public byte[] getEncryptedKey()
public AlgorithmId getKeyEncryptionAlgorithm() throws IOException
public RecipientIdentifier getRecipientIdentifier()
public EntityIdentifier getEntityIdentifier()
public boolean identifies(Certificate cert) throws IOException
cert
- an X.509 certificate.public byte[] decryptKey(PrivateKey key) throws PKCSException
key
- the private key used for decryption.protected void finalize()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |