iaik.cms
Class UnknownOtherRecipientInfoValue

java.lang.Object
  extended by iaik.cms.OtherRecipientInfoValue
      extended by iaik.cms.UnknownOtherRecipientInfoValue
All Implemented Interfaces:
ASN1Type

public class UnknownOtherRecipientInfoValue
extends OtherRecipientInfoValue

This class implements any unknown OtherRecipientInfo value. It tries to show as much information as possible about the OtherRecipientInfo value.

An Unknown OtherRecipientInfo value is a OtherRecipientInfo value for which there exists no registered implementation.

When decoding a the OtherRecipientInfo value contained in an OtherRecipientInfo from its ASN.1 representation a descendant of OtherRecipientInfoValue is created if there exists a registered implementation of the OtherRecipientInfo value identified by the key manegement type OID. If no implementation exists, an UnknownOtherRecipientInfoValue is returned allowing to get and parse the ASN.1 representation of the OtherRecipientInfo value. Any other methods like encryptKey or decryptKey inherited from class RecipientInfo are implemented as dummys since it cannot be supported by this general unknown OtherRecipientInfo.

See Also:
RecipientInfo, OtherRecipientInfo

Field Summary
 
Fields inherited from class iaik.cms.OtherRecipientInfoValue
keyEncryptionAlgorithm_, securityProvider_
 
Constructor Summary
UnknownOtherRecipientInfoValue(ObjectID type)
          Creates a new unknown OtherRecipientInfo value from the given object identifier.
 
Method Summary
 void decode(ASN1Object obj)
          Reads the ASN.1 representation of the unknown OtherRecipientInfo value.
 javax.crypto.SecretKey decryptKey(java.security.Key key, KeyIdentifier recipientIdentifier, java.lang.String cekAlgName)
          Attention!
 void encryptKey(javax.crypto.SecretKey cek)
          Attention!
 byte[] getEncryptedKey(KeyIdentifier recipientIdentifier)
          Attention!
 KeyIdentifier[] getRecipientIdentifiers()
          Attention!
 ObjectID getType()
          Returns the OtherRecipientInfo type the unknown OtherRecipientInfo value belongs to.
 boolean isRecipientInfoFor(KeyIdentifier recipientIdentifier)
          Attention!
 CertificateIdentifier isRecipientInfoFor(X509Certificate recipientCertificate)
          Attention!
 ASN1Object toASN1Object()
          Returns an ASN1Object representing this unknown OtherRecipientInfo value.
 java.lang.String toString()
          Returns a string that represents the contents of this unknown OtherRecipientInfo value.
 
Methods inherited from class iaik.cms.OtherRecipientInfoValue
getKeyEncryptionAlgorithm, getName, getSecurityProvider, setSecurityProvider
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UnknownOtherRecipientInfoValue

public UnknownOtherRecipientInfoValue(ObjectID type)
Creates a new unknown OtherRecipientInfo value from the given object identifier.

Parameters:
type - the OID identifying the type the unknown OtherRecipientInfo value belongs to
Method Detail

getType

public ObjectID getType()
Returns the OtherRecipientInfo type the unknown OtherRecipientInfo value belongs to.

Specified by:
getType in class OtherRecipientInfoValue
Returns:
the OtherRecipientInfo type the unknown OtherRecipientInfo belongs to

decode

public void decode(ASN1Object obj)
Reads the ASN.1 representation of the unknown OtherRecipientInfo value.

Parameters:
obj - the ASN1Object representing the unknown OtherRecipientInfo value

toASN1Object

public ASN1Object toASN1Object()
Returns an ASN1Object representing this unknown OtherRecipientInfo value.

Returns:
the unknown OtherRecipientInfo value as ASN1Object

encryptKey

public void encryptKey(javax.crypto.SecretKey cek)
                throws CMSException
Attention! This method does nothing!

Specified by:
encryptKey in class OtherRecipientInfoValue
Parameters:
cek - the symmetric content encryption key to encrypt
Throws:
CMSException - if the key encryption process fails for some reason (e.g. the key-encryption algortihm used by this RecipientInfo is not implemented, or the recipient key is invalid, ...)

decryptKey

public javax.crypto.SecretKey decryptKey(java.security.Key key,
                                         KeyIdentifier recipientIdentifier,
                                         java.lang.String cekAlgName)
Attention! This method does nothing! It returns null in any case.

Specified by:
decryptKey in class OtherRecipientInfoValue
Parameters:
key - the recipient key used to decrypt the encrypted content-encryption key.
recipientIdentifier - information to be used for getting the right encrypted content encryption key for the right recipient
cekAlgName - the name of the content encryption key (e.g. "AES") to be set for the SecretKey object created by this method
Returns:
null

getEncryptedKey

public byte[] getEncryptedKey(KeyIdentifier recipientIdentifier)
                       throws CMSException
Attention! This method returns null in any case.

Specified by:
getEncryptedKey in class OtherRecipientInfoValue
Parameters:
recipientIdentifier - information to be used for getting the right encrypted content encryption key for the right recipient; may be required if this RecipientInfo holds content encryption keys for more than one recipient (see KeyAgreeRecipientInfo)
Returns:
null
Throws:
CMSException - if no recipient with this key identifier is included

getRecipientIdentifiers

public KeyIdentifier[] getRecipientIdentifiers()
Attention! This method returns an empty KeyIdentifier array in any case.

Specified by:
getRecipientIdentifiers in class OtherRecipientInfoValue
Returns:
an empty KeyIdentifier array

isRecipientInfoFor

public boolean isRecipientInfoFor(KeyIdentifier recipientIdentifier)
Attention! This method returns false in any case.

Specified by:
isRecipientInfoFor in class OtherRecipientInfoValue
Parameters:
recipientIdentifier - the key identifier belonging to the recipient we are searching for
Returns:
false

isRecipientInfoFor

public CertificateIdentifier isRecipientInfoFor(X509Certificate recipientCertificate)
Attention! This method returns null in any case.

Specified by:
isRecipientInfoFor in class OtherRecipientInfoValue
Parameters:
recipientCertificate - the certificate of the recipient
Returns:
null

toString

public java.lang.String toString()
Returns a string that represents the contents of this unknown OtherRecipientInfo value.

Overrides:
toString in class java.lang.Object
Returns:
the string representation

This Javadoc may contain text parts from text parts from IETF Internet Standard specifications (see copyright note).

IAIK-CMS 6.0, (c) 2002 IAIK, (c) 2003, 2023 SIC