iaik.smime.ess
Class ReceiptsFrom

java.lang.Object
  extended by iaik.smime.ess.ReceiptsFrom

public class ReceiptsFrom
extends java.lang.Object

The S/MIMEv3 ESS type ReceiptsFrom.

The Enhanced Security Services for S/MIMEv3 (ESS) (RFC 2634) specifies the ReceiptsFrom to be used within a ReceiptRequest attribute for indicating from whom signed receipts shall be requested:

 ReceiptsFrom ::= CHOICE {
   allOrFirstTier [0] AllOrFirstTier,
   -- formerly "allOrNone [0]AllOrNone"
   receiptList [1] SEQUENCE OF GeneralNames }

 AllOrFirstTier ::= INTEGER { -- Formerly AllOrNone
   allReceipts (0),
   firstTierRecipients (1) }
 
When creating a new ReceiptsFrom you either may supply the allOrFirstTier value indicating to request receipts from all recipients (0), or from first tier recipients that receive the message as members of a mailing list, or you may supply a specific list of recipients requested to send a signed receipt:
 int allOrFirstTier = ReceiptsFrom.ALL_RECIPIENTS;
 ReceiptsFrom receiptsFrom = new ReceiptsFrom(allOrFirstTier);
 
respectively
 GeneralNames[] receiptList = ...;
 ReceiptsFrom receiptsFrom = new ReceiptsFrom(receiptList);
 

See Also:
ReceiptRequest

Field Summary
static int ALL_RECIPIENTS
          The AllOrFirstTier value allReceipts (0).
static int FIRST_TIER_RECIPIENTS
          The AllOrFirstTier value firstTierRecipients (1).
 
Constructor Summary
ReceiptsFrom(ASN1Object obj)
          Creates an ReceiptsFrom from an ASN1Object
ReceiptsFrom(GeneralNames[] receiptList)
          Creates a ReceiptsFrom from the given receiptList.
ReceiptsFrom(int allOrFirstTier)
          Creates a ReceiptsFrom from the given allOrFirstTier value.
ReceiptsFrom(java.lang.String[] recipientAddresses)
          Creates a ReceiptsFrom from the given recipients.
 
Method Summary
 void decode(ASN1Object obj)
          Decodes the given ASN.1 ReceiptsFrom object for parsing the internal structure.
 boolean equals(java.lang.Object obj)
          Compares this ReceiptsFrom to the specified object.
 int getAllOrFirstTier()
          Returns the allOrFirstTier value.
 GeneralNames[] getReceiptList()
          Returns a list of recipients requested to send a receipts.
 java.lang.String[] getRecipientAddresses()
          Returns all recipient email addresses included in this ReceiptsFrom.
 int hashCode()
          Returns a hashcode for this object.
 ASN1Object toASN1Object()
          Returns this ReceiptsFrom as ASN1Object.
 java.lang.String toString()
          Returns a string representation of this ReceiptsFrom.
 java.lang.String toString(boolean detailed)
          Returns a string representation of this ReceiptsFrom.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ALL_RECIPIENTS

public static final int ALL_RECIPIENTS
The AllOrFirstTier value allReceipts (0). Indicates that receipts from all recipients are requested.

See Also:
Constant Field Values

FIRST_TIER_RECIPIENTS

public static final int FIRST_TIER_RECIPIENTS
The AllOrFirstTier value firstTierRecipients (1). Indicates that receipts from first tier (recipients that did not receive the message as members of a mailing list) recipients are requested.

See Also:
Constant Field Values
Constructor Detail

ReceiptsFrom

public ReceiptsFrom(int allOrFirstTier)
             throws java.lang.IllegalArgumentException
Creates a ReceiptsFrom from the given allOrFirstTier value.

Parameters:
allOrFirstTier - the allOrFirstTier value, indicating to request receipts from all recipients (0), or only from first tier recipients that receive the message as members of a mailing list
Throws:
java.lang.IllegalArgumentException - if the supplied allOrFirstTier value is invalid (not 0 or 1)

ReceiptsFrom

public ReceiptsFrom(GeneralNames[] receiptList)
             throws java.lang.IllegalArgumentException
Creates a ReceiptsFrom from the given receiptList.

Parameters:
receiptList - the list of recipients requested to send receipts
Throws:
java.lang.IllegalArgumentException

ReceiptsFrom

public ReceiptsFrom(java.lang.String[] recipientAddresses)
             throws java.lang.IllegalArgumentException
Creates a ReceiptsFrom from the given recipients.

This constructor may be used to immediately supply the email addresses of the intended recipients. The required GeneralNames structures are internally created (for each email address one GeneralNames with only one GeneralName entry of type rfc822Name).

Parameters:
recipientAddresses - the email addresses of the intended recipients
Throws:
java.lang.IllegalArgumentException

ReceiptsFrom

public ReceiptsFrom(ASN1Object obj)
             throws CodingException
Creates an ReceiptsFrom from an ASN1Object

Parameters:
obj - the ReceiptsFrom as ASN1Object
Throws:
CodingException - if the encoding is invalid
Method Detail

getAllOrFirstTier

public int getAllOrFirstTier()
Returns the allOrFirstTier value.

If the value is 0 receipts are requested from all recipients. If the value os 1 receipts are requested from first tier recipients that receive the message as members of a mailing list. If the value is -1 method getReceiptList may be called to get a specific list of recipients requested to send receipts.

Returns:
the allOrFirstTier value, either 0 (request receipts from all recipients), 1 (request receipts from first tier recipients only), or -1 (request receipts from a specific list of recipients)

getReceiptList

public GeneralNames[] getReceiptList()
Returns a list of recipients requested to send a receipts.

If this method returns null method getAllOrFirstTier to get the sllOrFirstTier value indicating from whom receipts are to be requested.

Returns:
the receiptList giving the recipients requested to send a receipt, or null if this is a allOrFirstTier ReceiptsFrom

getRecipientAddresses

public java.lang.String[] getRecipientAddresses()
Returns all recipient email addresses included in this ReceiptsFrom.

This method searches the receiptList GeneralNames for all GeneralName objects of type rfc822Name. Any GeneralName of type rfc822Name contributes to the String array of email addresses returned by this method.

Returns:
the email addresses of the recipients or null if no reeiptList is set or no email addresses are specified

decode

public void decode(ASN1Object obj)
            throws CodingException
Decodes the given ASN.1 ReceiptsFrom object for parsing the internal structure.

Parameters:
obj - the ReceiptsFrom as ASN1Object
Throws:
CodingException - if the encoding is invalid

toASN1Object

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

Returns:
this ReceiptsFrom as ASN1Object
Throws:
CodingException

equals

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

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare this ReceiptsFrom against.
Returns:
true, if the given object is equal to this ReceiptsFrom, 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

toString

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

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

toString

public java.lang.String toString(boolean detailed)
Returns a string representation of this ReceiptsFrom.

Parameters:
detailed - whether to give detailed information
Returns:
a string representation of this ReceiptsFrom

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