iaik.smime.ess
Class MLReceiptPolicy

java.lang.Object
  extended by iaik.smime.ess.MLReceiptPolicy
All Implemented Interfaces:
java.lang.Cloneable

public class MLReceiptPolicy
extends java.lang.Object
implements java.lang.Cloneable

This class implements the S/MIMEv3 MLReceiptPolicy type.

The Enhanced Security Services for S/MIMEv3 (ESS) (RFC 2634) specifies the MLReceiptPolicy type for allowing a mailing list (ML) to supersede the originator request for signed receipts:

 
 MLReceiptPolicy ::= CHOICE {
   none [0] NULL,
   insteadOf [1] SEQUENCE SIZE (1..MAX) OF GeneralNames,
   inAdditionTo [2] SEQUENCE SIZE (1..MAX) OF GeneralNames }
 
If present in a MLData of a MLExpansionHistory attribute, the MLReceiptPolicy may indicate to return none receipt, or to return receipts to an alternate list of recipients instead of the originator, or to return receipts to an list of recipients in addition to to the originator.

When creating a MLReceiptPolicy object you have to specify the policy value (NONE, INSTEAD_OF, or IN_ADDITION_TO). If required a recipient list may be set by calling a proper setRecipientList method, e.g.:

 // a list of recipients to which receipts should be returned in addition to the originator:
 GeneralNames[] recipientList = ...;
 // create a MLReceiptPolicy of appropriate value:
 MLReceiptPolicy mlReceiptPolicy = new MLReceiptPolicy(MLReceiptPolicy.IN_ADDITION_TO);
 mlReceiptPolicy.setRecipientList(recipientList);
 

See Also:
MLData, MLExpansionHistory

Field Summary
static int IN_ADDITION_TO
          Receipt policy value IN_ADDITION_TO (2).
static int INSTEAD_OF
          Receipt policy value INSTEAD_OF (1).
static int NONE
          Receipt policy value NONE (0).
 
Constructor Summary
MLReceiptPolicy(ASN1Object obj)
          Creates a MLReceiptPolicy from its ASN.1 representation.
MLReceiptPolicy(int value)
          Creates a MLReceiptPolicy for given policy value and recipientList, if required.
 
Method Summary
 java.lang.Object clone()
          Returns a clone of this object.
 boolean equals(java.lang.Object obj)
          Compares this MLReceiptPolicy to the specified object.
 GeneralNames[] getRecipientList()
          Returns the list of recipients to which a receipt should be returned instead of or in addition to the originator.
 int getValue()
          Returns the value of this MLReceiptPolicy.
 int hashCode()
          Returns a hashcode for this object.
 void setRecipientList(GeneralNames[] recipientList)
          Sets the recipient list of this MLReceiptPolicy.
 void setRecipientList(java.lang.String[] recipients)
          Sets the recipient address list of this MLReceiptPolicy.
 ASN1Object toASN1Object()
          Returns this MLReceiptPolicy as ASN1Object.
 java.lang.String toString()
          Returns a string representation of this MLReceiptPolicy.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
Receipt policy value NONE (0). Indicates that receipts MUST NOT be returned.

See Also:
Constant Field Values

INSTEAD_OF

public static final int INSTEAD_OF
Receipt policy value INSTEAD_OF (1). Indicates that receipts should be returned to an alternate list of recipients, instead of the originator.

See Also:
Constant Field Values

IN_ADDITION_TO

public static final int IN_ADDITION_TO
Receipt policy value IN_ADDITION_TO (2). Indicates that receipts should be returned to an list of recipients in addition to the originator.

See Also:
Constant Field Values
Constructor Detail

MLReceiptPolicy

public MLReceiptPolicy(int value)
Creates a MLReceiptPolicy for given policy value and recipientList, if required.

The policy value either may indicate to return NONE (value = 0) receipt, or to return receipts to an alternate list of recipients instead of the originator (value = 1), or to return receipts to an list of recipients in addition to (value = 2) to the originator. A recipientList only has to be supplied for policy value 1 (INSTEAD_OF) or 2 (IN_ADDITION_TO), e.g.:

 // a list of recipients to which receipts should be returned in addition to the originator:
 GeneralNames recipientList = ...;
 // create a MLReceiptPolicy of appropriate value:
 MLReceiptPolicy mlReceiptPolicy = new MLReceiptPolicy(MLReceiptPolicy.IN_ADDITION_TO);
 mlReceiptPolicy.setRecipientList(recipientList);  
 

Parameters:
value - the policy value, either 0 (NONE) 1 (INSTEAD_OF) 2 (IN _ADDITION_TO)
Throws:
java.lang.IllegalArgumentException - if the value is invalid (not 0, 1 or 2)

MLReceiptPolicy

public MLReceiptPolicy(ASN1Object obj)
                throws CodingException
Creates a MLReceiptPolicy from its ASN.1 representation.

Parameters:
obj - the MLReceiptPolicy as ASN1Object
Throws:
CodingException - if the ASN.1 structure is invalid
Method Detail

setRecipientList

public void setRecipientList(GeneralNames[] recipientList)
Sets the recipient list of this MLReceiptPolicy.

Parameters:
recipientList - the list of recipients to which receipts should be returned instead of (value = 1) or in addition to (value = 2) to the originator;
Throws:
java.lang.IllegalArgumentException - if no recipient list is required since this MLRecipeiptPolicy does not require any receipt to be sent (value = NONE)

setRecipientList

public void setRecipientList(java.lang.String[] recipients)
Sets the recipient address list of this MLReceiptPolicy.

Parameters:
recipients - the list of recipient addresses to which receipts should be returned instead of (value = 1) or in addition to (value = 2) to the originator;
Throws:
java.lang.IllegalArgumentException - if no recipient list is required since this MLRecipeiptPolicy does not require any receipt to be sent (value = NONE)

getValue

public int getValue()
Returns the value of this MLReceiptPolicy.

The policy value either may indicate to return NONE (value = 0) receipt, or to return receipts to an alternate list of recipients (value = 1), or to return receipts to an list of recipients in addition to (value = 2) the originator.

Returns:
the policy value, either 0 (NONE) 1 (INSTEAD_OF) 2 (IN _ADDITION_TO)

getRecipientList

public GeneralNames[] getRecipientList()
Returns the list of recipients to which a receipt should be returned instead of or in addition to the originator.

This method only may be used if the policy value is 1 (INSTEAD_OF) or 2 (IN_ADDITION_TO) for getting the recipients to which a receipt should be returned instead of or in addition to the originator.

Returns:
the list of recipients to which a receipt should be returned instead of or in addition to the originator

equals

public boolean equals(java.lang.Object obj)
Compares this MLReceiptPolicy to the specified object.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare this MLReceiptPolicy against.
Returns:
true, if the given object is equal to this MLReceiptPolicy, false otherwise

hashCode

public int hashCode()
Returns a hashcode for this object.

Overrides:
hashCode in class java.lang.Object
Returns:
a hashcode for this object

toASN1Object

public ASN1Object toASN1Object()
                        throws CodingException
Returns this MLReceiptPolicy as ASN1Object.

Returns:
this MLReceiptPolicy as ASN1Object
Throws:
CodingException - if an error occurs when creating the ASN1Object

clone

public java.lang.Object clone()
Returns a clone of this object.

Overrides:
clone in class java.lang.Object
Returns:
a clone of this object

toString

public java.lang.String toString()
Returns a string representation of this MLReceiptPolicy.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this MLReceiptPolicy.

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