|
IAIK CMS/SMIME Toolkit Demo API Documentation
Version 6.1 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectdemo.smime.ess.SignedReceiptDemo
public class SignedReceiptDemo
An RFC2634 ESS ReceiptRequest -- SignedReceipt demo.
This demo creates a message with a ReceiptRequest attribute and "sends" it to some intended recipient.
The recipient then "sends" a signed receipt message back to the
original sender who finally validates the signed receipt.
A further test run adds a MLA layer with a MLExpansionHistory attribute,
that supersedes the original receipt request.
To run this demo the following packages are required:
iaik_cms.jar
iaik_jce(_full).jar (IAIK-JCE Core Crypto Library).
mail.jar (JavaMail API).
activation.jar (Java Activation Framework; required for JDK versions < 1.6).
ReceiptRequest,
Receipt,
MLExpansionHistory,
MLData,
MLReceiptPolicy,
SignedReceipt| Constructor Summary | |
|---|---|
SignedReceiptDemo()
Empty default constructor. |
|
| Method Summary | |
|---|---|
javax.mail.Message |
createMessage(javax.mail.Session session,
java.lang.String from,
java.lang.String to,
java.lang.String subject)
Creates a MimeMessage. |
javax.mail.Message |
createMessageWithSignedReceipt(javax.mail.Session session,
javax.mail.Message receivedMsg)
Creates a signed-receipt message from the received message. |
static iaik.smime.ess.MLExpansionHistory |
createMLExpansionHistory(iaik.x509.X509Certificate mlaCertificate,
java.util.Date expansionTime,
java.lang.String mlaEmailAddress)
Creates a MLExpansionHistory containing only one MLData for the given MLA with given expansion time and a MLReceiptPolicy of type IN_ADDITION_TO for the given mlaEmailAddress. |
iaik.smime.ess.ReceiptRequest |
createReceiptRequest(java.security.PublicKey publicKey,
java.util.Date sentDate,
java.lang.String email)
Creates a ReceiptRequest attribute to request all recipients to send a signed receipt to the entity to the given email address. |
javax.mail.Message |
createSignedMessageWithReceiptRequest(javax.mail.Session session,
boolean implicit,
java.io.OutputStream os)
Creates a signed message that contains a ReceiptRequest attribute. |
static void |
main(java.lang.String[] argv)
Main method. |
void |
start()
Starts the SignedReceipt demo. |
void |
storeDigestValues(iaik.smime.SignedContent signedContent)
Keeps the signature message digest value of the sender and the receipt content digest values for later SignedReceipt validation. |
void |
test(boolean implicit,
boolean mla)
Runs the ReceiptRequest - SignedReceipt test. |
void |
verifyReceiptContent(javax.mail.Message receiptMsg)
Validates a signed receipt message received in return to a receipt request message. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SignedReceiptDemo()
| Method Detail |
|---|
public void start()
public void test(boolean implicit,
boolean mla)
implicit - whether to create implicit (application/pkcs7-mime) or
explicit (multipart/signed) ReceiptRequest messagesmla - whether to add a MLA layer
public javax.mail.Message createMessage(javax.mail.Session session,
java.lang.String from,
java.lang.String to,
java.lang.String subject)
throws javax.mail.MessagingException
session - the current mail sessionfrom - the sender of the messageto - the recipient of the messagesubject - the subject of the message
javax.mail.MessagingException - if an error occurs when creating the message
public javax.mail.Message createSignedMessageWithReceiptRequest(javax.mail.Session session,
boolean implicit,
java.io.OutputStream os)
throws java.lang.Exception
ReceiptRequest attribute.
session - the current mail sessionimplicit - whether to sign the content implicitly or explicitlyos - the output stream to which to write the message
java.lang.Exception
public iaik.smime.ess.ReceiptRequest createReceiptRequest(java.security.PublicKey publicKey,
java.util.Date sentDate,
java.lang.String email)
publicKey - the public key of the sender (used for ContentIdentifier calculation)sentDate - the sent date of the message (used for ContentIdentifier calculation)email - the email address of the sender (to whom to return a signed receipt)
public static iaik.smime.ess.MLExpansionHistory createMLExpansionHistory(iaik.x509.X509Certificate mlaCertificate,
java.util.Date expansionTime,
java.lang.String mlaEmailAddress)
mlaCertificate - the certificate of the MLA from which to create the
MLData EntityIdentiifier of type IssuerAndSerialNumberexpansionTime - the expansion timemlaEmailAddress - to be set as IN_ADDITION_TO recipient list for
the MLData MLRecipientPolicy
public void storeDigestValues(iaik.smime.SignedContent signedContent)
throws iaik.smime.ess.ESSException
signedContent - the signed message for which to keep the digest values
iaik.smime.ess.ESSException - if an error occurs while gathering the required digest values
public javax.mail.Message createMessageWithSignedReceipt(javax.mail.Session session,
javax.mail.Message receivedMsg)
throws java.lang.Exception
session - the current mail sessionreceivedMsg - the message containing a ReceiptRequest attribute
java.lang.Exception - if some error occurs during receipt request processing
or signed receipt creation
public void verifyReceiptContent(javax.mail.Message receiptMsg)
throws java.lang.Exception
receiptMsg - the message containing the signed receipt
java.lang.Exception - if the receipt validation fails for some reason
public static void main(java.lang.String[] argv)
throws java.io.IOException
java.io.IOException
|
IAIK CMS/SMIME Toolkit Demo API Documentation
Version 6.1 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
|
v6.1 (c) 2002 IAIK, (c) 2003 - 2025 SIC |
|