IAIK CMS/SMIME Toolkit Demo API Documentation
Version 6.1

demo.smime
Class DumpMessage

java.lang.Object
  extended by demo.smime.DumpMessage

public class DumpMessage
extends java.lang.Object

Simple utility for dumping a message to System.out. The parts of the message are recursively dumped. Note that this utility is not thread-safe (i.e. only one private key can be statically set to decrypt an encrypted content part.


Constructor Summary
DumpMessage()
          Default constructor.
 
Method Summary
 void dump(java.lang.Object o)
          Dumps the given object (message, part,...) to System.out.
 void dumpAuthEncrypted(iaik.smime.AuthEncryptedContent ec, iaik.cms.KeyIdentifier recipientKeyId)
          Dumps the given authenticated encrypted content.
 void dumpEncrypted(iaik.smime.EncryptedContent ec, iaik.cms.KeyIdentifier recipientKeyId)
          Dumps the given encrypted content.
 void dumpEncrypted(iaik.smime.EncryptedContent ec, iaik.cms.KeyIdentifier recipientKeyId, java.security.PrivateKey recipientKey)
          Dumps the given encrypted content for the recipient identified by the given recipient key id using the given private recipient decryption key.
static void dumpEncryptedMessage(javax.mail.Message msg)
          Dumps the given encrypted message and decrypts the content for the several recipients.
 void dumpEnvelope(javax.mail.Message m)
          Prints the envelope of a message.
static void dumpMsg(javax.mail.Message msg)
          Dumps the given message to System.out.
 void dumpPKCS10(iaik.smime.PKCS10Content pkcs10)
          Dumps the given PKCS#10 content.
 void dumpReceiptContent(iaik.smime.ess.ReceiptContent rc)
          Dumps the given signed receipt.
 void dumpSigned(iaik.smime.SignedContent sc)
          Dumps the given signed content.
 iaik.x509.X509Certificate[] getSignerCerts()
          Gets the certificates of the signer included in a signed message.
 void setRecipientKey(java.security.PrivateKey recipientKey)
          Sets the private recipient key to be used to decrypt an encrypted message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DumpMessage

public DumpMessage()
Default constructor.

Method Detail

dumpMsg

public static void dumpMsg(javax.mail.Message msg)
                    throws java.lang.Exception
Dumps the given message to System.out.

Parameters:
msg - the message to be dumped
Throws:
java.lang.Exception - if an error occurs

dumpEncryptedMessage

public static void dumpEncryptedMessage(javax.mail.Message msg)
                                 throws java.lang.Exception
Dumps the given encrypted message and decrypts the content for the several recipients.

Parameters:
msg - the message to be dumped
Throws:
java.lang.Exception - if an error occurs

setRecipientKey

public void setRecipientKey(java.security.PrivateKey recipientKey)
Sets the private recipient key to be used to decrypt an encrypted message.
If not set the CMSKeyStore used by the demos is CMSKeyStore#getRecipientCert(KeyIdentifier) searched for a recipient decryption key based on the recipient key identifier.

Parameters:
recipientKey - the private key of the recipient

getSignerCerts

public iaik.x509.X509Certificate[] getSignerCerts()
Gets the certificates of the signer included in a signed message.

Returns:
the signer certificates; it the message is signed and contains the certificate of the signer; null otherwise.

dump

public void dump(java.lang.Object o)
          throws java.lang.Exception
Dumps the given object (message, part,...) to System.out.

Parameters:
o - the object to be dumped
Throws:
java.lang.Exception - if an error occurs

dumpEncrypted

public void dumpEncrypted(iaik.smime.EncryptedContent ec,
                          iaik.cms.KeyIdentifier recipientKeyId)
                   throws java.lang.Exception
Dumps the given encrypted content.

Parameters:
ec - the EncryptedContent to be dumped
recipientKeyId - the id of the recipient key to be used for decrypting the content
Throws:
java.lang.Exception - if an error occurs

dumpEncrypted

public void dumpEncrypted(iaik.smime.EncryptedContent ec,
                          iaik.cms.KeyIdentifier recipientKeyId,
                          java.security.PrivateKey recipientKey)
                   throws java.lang.Exception
Dumps the given encrypted content for the recipient identified by the given recipient key id using the given private recipient decryption key.

Parameters:
ec - the EncryptedContent to be dumped
recipientKeyId - the id of the recipient key to be used for decrypting the content
recipientKey - the private key of the recipient
Throws:
java.lang.Exception - if an error occurs

dumpAuthEncrypted

public void dumpAuthEncrypted(iaik.smime.AuthEncryptedContent ec,
                              iaik.cms.KeyIdentifier recipientKeyId)
                       throws java.lang.Exception
Dumps the given authenticated encrypted content.

Parameters:
ec - the AuthEncryptedContent to be dumped
recipientKeyId - the id of the recipient key to be used for decrypting the content
Throws:
java.lang.Exception - if an error occurs

dumpSigned

public void dumpSigned(iaik.smime.SignedContent sc)
                throws java.lang.Exception
Dumps the given signed content.

Parameters:
sc - the SignedContent to be dumped
Throws:
java.lang.Exception - if an error occurs

dumpPKCS10

public void dumpPKCS10(iaik.smime.PKCS10Content pkcs10)
                throws java.lang.Exception
Dumps the given PKCS#10 content.

Parameters:
pkcs10 - the PKCS10Content to be dumped
Throws:
java.lang.Exception - if an error occurs

dumpReceiptContent

public void dumpReceiptContent(iaik.smime.ess.ReceiptContent rc)
                        throws java.lang.Exception
Dumps the given signed receipt.

Parameters:
rc - the signed receipt to be dumped
Throws:
java.lang.Exception - if an error occurs

dumpEnvelope

public void dumpEnvelope(javax.mail.Message m)
                  throws javax.mail.MessagingException
Prints the envelope of a message.

Parameters:
m - the message
Throws:
javax.mail.MessagingException - if an error occurs

IAIK CMS/SMIME Toolkit Demo API Documentation
Version 6.1

v6.1
(c) 2002 IAIK, (c) 2003 - 2025 SIC