Oracle Security Developer Tools S/MIME Java API Reference
10g (10.1.4.0.1)

B28172-01


oracle.security.crypto.smime
Class SmimeSignedReceipt

java.lang.Object
  extended byoracle.security.crypto.smime.SmimeSignedReceipt

All Implemented Interfaces:
SmimeObject, SmimeSignedObject

public class SmimeSignedReceipt
extends java.lang.Object
implements SmimeSignedObject

This class encapsulates a wrapped signed receipt.


Constructor Summary
SmimeSignedReceipt(oracle.security.crypto.cms.ESSReceipt receipt, byte[] msgSigDigest, javax.mail.Address[] receiptsToAddresses)
          Create a SmimeSignedReceipt.
SmimeSignedReceipt(java.io.InputStream is)
          Create a SmimeSignedReceipt by reading the BER encoding from the specified input stream.
SmimeSignedReceipt(SmimeSignedObject smimeObj)
          Create a SmimeSignedReceipt.
SmimeSignedReceipt(SmimeSignedObject smimeSigned, oracle.security.crypto.cert.X509 signerCert, javax.mail.Address[] messageRecipientAddresses)
          Create a SmimeSignedReceipt using the signed message containing a receipt request.
SmimeSignedReceipt(SmimeSignedObject smimeSigned, oracle.security.crypto.cert.X509 signerCert, javax.mail.Address[] messageRecipientAddresses, MLExpansionHistory mlExpansionHistory)
          Create a SmimeSignedReceipt using the signed message containing a receipt request.

 

Method Summary
 void addCertificate(oracle.security.crypto.cert.X509 cert)
           
 void addCRL(oracle.security.crypto.cert.CRL crl)
           
 void addSignature(oracle.security.crypto.core.PrivateKey signerKey, oracle.security.crypto.cert.X509 signerCert, oracle.security.crypto.core.AlgorithmIdentifier digestAlgID)
           
 void addSignature(oracle.security.crypto.core.PrivateKey signerKey, oracle.security.crypto.cert.X509 signerCert, oracle.security.crypto.core.AlgorithmIdentifier digestAlgID, oracle.security.crypto.cert.AttributeSet signedAttributes)
           
 void addSignature(oracle.security.crypto.core.PrivateKey signerKey, oracle.security.crypto.cert.X509 signerCert, oracle.security.crypto.core.AlgorithmIdentifier digestAlgID, java.util.Date timeStamp)
           
 void addSignature(oracle.security.crypto.core.PrivateKey signerKey, oracle.security.crypto.cert.X509 signerCert, oracle.security.crypto.core.AlgorithmIdentifier digestAlgID, java.util.Date timeStamp, SmimeCapabilities smimeCaps)
           
 void addSignature(oracle.security.crypto.core.PrivateKey signerKey, oracle.security.crypto.cert.X509 signerCert, oracle.security.crypto.core.AlgorithmIdentifier digestAlgID, SmimeCapabilities smimeCaps)
           
 java.lang.String generateContentType()
          Returns the content type of this smime object.
 java.lang.String generateContentType(boolean useStandardContentTypes)
          Returns the content type of this smime object.
 java.util.Vector getCertificates()
          Returns the list of Certificates included with this signed data object, or null if no list of Certificates is present.
 java.util.Vector getCRLs()
          Returns the list of CRLs included with this signed data object, or null if no list of CRLs is present.
 javax.mail.internet.MimeBodyPart getEnclosedBodyPart()
          Returns a MimeBodyPart containing a DER encoded ESS Receipt.
 oracle.security.crypto.cms.ESSReceipt getEnclosedReceipt()
          Returns the ESS Receipt.
 EquivalentLabels getEquivalentLabels(oracle.security.crypto.cert.X509 signerCert)
          Returns the EquivalentLabels if present or null.
 ESSSecurityLabel getESSSecurityLabel(oracle.security.crypto.cert.X509 signerCert)
          Returns the ESSSecurityLabel if present or null.
 MLExpansionHistory getMLExpansionHistory(oracle.security.crypto.cert.X509 signerCert)
          Returns the MLExpansionHistory if present or null.
 ReceiptRequest getReceiptRequest(oracle.security.crypto.cert.X509 signerCert)
          Returns the ReceiptRequest if present or null.
 javax.mail.Address[] getReceiptsToAddresses()
          Returns the list of recipients to whom the receipt must be sent.
 SigningCertificate getSigningCertificate(oracle.security.crypto.cert.X509 signerCert)
          Returns the SigningCertificate Attribute if present or null.
 java.util.Enumeration signers()
          Returns the signatures on this signed data object, in the form of an enumeration, each element of which is an instance of CMSSignerInfo.
 void verify(oracle.security.crypto.cert.CertificateTrustPolicy trustPolicy)
          Returns normally if this CMS signed data object contains at least one valid signature, according to the given trust policy; otherwise throws an AuthenticationException.
 void verify(oracle.security.crypto.cert.CertificateTrustPolicy trustPolicy, javax.mail.Address[] senderAddresses)
          Does the same thing as verify(CertificateTrustPolicy), except that in addition, it checks to make sure that the terminating certificate of the validating certificate chain contains an email address which is present in the specified list of sender addresses.
 void verifyReceipt(SmimeSignedObject originalSmimeSignedObject, oracle.security.crypto.cert.X509 signerCert)
          Stores the SignerInfo object that contains the original receipt request that will be used to validate a received receipt
 void verifySignature(oracle.security.crypto.cert.X509 signerCert)
          Returns successfully if this CMS signed data object contains a signature which is validated by the given certificate; otherwise throws an AuthenticationException.
 void verifySignature(oracle.security.crypto.cert.X509 signerCert, javax.mail.Address[] senderAddresses)
          Does the same thing as verifySignature(X509), except that in addition, it checks to make sure that the email address in the given certificate is present in the specified list of sender addresses.
 void writeTo(java.io.OutputStream os, java.lang.String mimeType)
          Writes this SmimeSigned to the given output stream.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

SmimeSignedReceipt

public SmimeSignedReceipt(SmimeSignedObject smimeSigned,
                          oracle.security.crypto.cert.X509 signerCert,
                          javax.mail.Address[] messageRecipientAddresses)
                   throws oracle.security.crypto.util.InvalidInputException,
                          ESSException
Create a SmimeSignedReceipt using the signed message containing a receipt request.
Parameters:
smimeSigned - A signed message (must not be a signed receipt).
signerCert - The signer certificate that will be used to verify the signature.
messageRecipientAddresses - Addresses of the message recipient.
Throws:
oracle.security.crypto.util.InvalidInputException - The receipt request attribute encoding was incorrect or multipe receipt request attribute were present or the input signed object is a receipt.
ESSException - This message does not require a receipt be generated.

SmimeSignedReceipt

public SmimeSignedReceipt(SmimeSignedObject smimeSigned,
                          oracle.security.crypto.cert.X509 signerCert,
                          javax.mail.Address[] messageRecipientAddresses,
                          MLExpansionHistory mlExpansionHistory)
                   throws oracle.security.crypto.util.InvalidInputException,
                          ESSException
Create a SmimeSignedReceipt using the signed message containing a receipt request.
Parameters:
smimeSigned - A signed message (must not be a signed receipt).
signerCert - The signer certificate that will be used to verify the signature.
mlExpansionHistory - The MLExpansionHistory attribute present in the outermost signed-data block or null otherwise.
messageRecipientAddresses - Addresses of the message recipient.
Throws:
oracle.security.crypto.util.InvalidInputException - The receipt request attribute encoding was incorrect or multipe receipt request attributes were present.
ESSException - This message does not require a receipt be generated.

SmimeSignedReceipt

public SmimeSignedReceipt(SmimeSignedObject smimeObj)
                   throws oracle.security.crypto.util.InvalidInputException
Create a SmimeSignedReceipt.
Parameters:
smimeObj - The SmimeSignedObject containing a receipt.
Throws:
oracle.security.crypto.util.InvalidInputException - The signed object does not contain a receipt.

SmimeSignedReceipt

public SmimeSignedReceipt(oracle.security.crypto.cms.ESSReceipt receipt,
                          byte[] msgSigDigest,
                          javax.mail.Address[] receiptsToAddresses)
Create a SmimeSignedReceipt.
Parameters:
receipt - The pre-computed receipt to send.

SmimeSignedReceipt

public SmimeSignedReceipt(java.io.InputStream is)
                   throws java.io.IOException
Create a SmimeSignedReceipt by reading the BER encoding from the specified input stream.
Parameters:
is - The input stream.
Throws:
java.io.IOException - The input encoding is not correct or an I/O error occurred.

Method Detail

addCertificate

public void addCertificate(oracle.security.crypto.cert.X509 cert)

addCRL

public void addCRL(oracle.security.crypto.cert.CRL crl)

addSignature

public void addSignature(oracle.security.crypto.core.PrivateKey signerKey,
                         oracle.security.crypto.cert.X509 signerCert,
                         oracle.security.crypto.core.AlgorithmIdentifier digestAlgID)
                  throws oracle.security.crypto.core.AlgorithmIdentifierException,
                         oracle.security.crypto.core.SignatureException,
                         oracle.security.crypto.core.InvalidKeyException
Throws:
oracle.security.crypto.core.AlgorithmIdentifierException
oracle.security.crypto.core.SignatureException
oracle.security.crypto.core.InvalidKeyException

addSignature

public void addSignature(oracle.security.crypto.core.PrivateKey signerKey,
                         oracle.security.crypto.cert.X509 signerCert,
                         oracle.security.crypto.core.AlgorithmIdentifier digestAlgID,
                         java.util.Date timeStamp)
                  throws oracle.security.crypto.core.AlgorithmIdentifierException,
                         oracle.security.crypto.core.SignatureException,
                         oracle.security.crypto.core.InvalidKeyException
Throws:
oracle.security.crypto.core.AlgorithmIdentifierException
oracle.security.crypto.core.SignatureException
oracle.security.crypto.core.InvalidKeyException

addSignature

public void addSignature(oracle.security.crypto.core.PrivateKey signerKey,
                         oracle.security.crypto.cert.X509 signerCert,
                         oracle.security.crypto.core.AlgorithmIdentifier digestAlgID,
                         SmimeCapabilities smimeCaps)
                  throws oracle.security.crypto.core.AlgorithmIdentifierException,
                         oracle.security.crypto.core.SignatureException,
                         oracle.security.crypto.core.InvalidKeyException
Throws:
oracle.security.crypto.core.AlgorithmIdentifierException
oracle.security.crypto.core.SignatureException
oracle.security.crypto.core.InvalidKeyException

addSignature

public void addSignature(oracle.security.crypto.core.PrivateKey signerKey,
                         oracle.security.crypto.cert.X509 signerCert,
                         oracle.security.crypto.core.AlgorithmIdentifier digestAlgID,
                         java.util.Date timeStamp,
                         SmimeCapabilities smimeCaps)
                  throws oracle.security.crypto.core.AlgorithmIdentifierException,
                         oracle.security.crypto.core.SignatureException,
                         oracle.security.crypto.core.InvalidKeyException
Throws:
oracle.security.crypto.core.AlgorithmIdentifierException
oracle.security.crypto.core.SignatureException
oracle.security.crypto.core.InvalidKeyException

addSignature

public void addSignature(oracle.security.crypto.core.PrivateKey signerKey,
                         oracle.security.crypto.cert.X509 signerCert,
                         oracle.security.crypto.core.AlgorithmIdentifier digestAlgID,
                         oracle.security.crypto.cert.AttributeSet signedAttributes)
                  throws oracle.security.crypto.core.AlgorithmIdentifierException,
                         oracle.security.crypto.core.SignatureException,
                         oracle.security.crypto.core.InvalidKeyException
Throws:
oracle.security.crypto.core.AlgorithmIdentifierException
oracle.security.crypto.core.SignatureException
oracle.security.crypto.core.InvalidKeyException

getReceiptsToAddresses

public javax.mail.Address[] getReceiptsToAddresses()
Returns the list of recipients to whom the receipt must be sent.
Returns:
The list of recipients or null.

getEnclosedReceipt

public oracle.security.crypto.cms.ESSReceipt getEnclosedReceipt()
Returns the ESS Receipt.
Returns:
The receipt.

getEnclosedBodyPart

public javax.mail.internet.MimeBodyPart getEnclosedBodyPart()
                                                     throws oracle.security.crypto.util.InvalidInputException,
                                                            javax.mail.MessagingException
Returns a MimeBodyPart containing a DER encoded ESS Receipt.
Specified by:
getEnclosedBodyPart in interface SmimeSignedObject
Returns:
The message content as a MimeBodyPart.
Throws:
oracle.security.crypto.util.InvalidInputException
javax.mail.MessagingException

getCertificates

public java.util.Vector getCertificates()
Returns the list of Certificates included with this signed data object, or null if no list of Certificates is present.
Specified by:
getCertificates in interface SmimeSignedObject
Returns:
A Vector containing X509 objects or null if no list of certificates is present.

getCRLs

public java.util.Vector getCRLs()
Returns the list of CRLs included with this signed data object, or null if no list of CRLs is present.
Specified by:
getCRLs in interface SmimeSignedObject
Returns:
A Vector containing CRL objects or null if no list of CRLs is present.

signers

public java.util.Enumeration signers()
Returns the signatures on this signed data object, in the form of an enumeration, each element of which is an instance of CMSSignerInfo.

This method never returns null.

Specified by:
signers in interface SmimeSignedObject
Returns:
A Vector containing CMSSignerInfo objects.

verifySignature

public void verifySignature(oracle.security.crypto.cert.X509 signerCert)
                     throws oracle.security.crypto.core.AuthenticationException,
                            oracle.security.crypto.cms.UnknownSignerException
Description copied from interface: SmimeSignedObject
Returns successfully if this CMS signed data object contains a signature which is validated by the given certificate; otherwise throws an AuthenticationException.

This method verifies the specified signature directly and ignores any certificates or CRLs which may be contained in this CMS object. A more complex verification process, which does make use of attached certificates and CRLs, is provided by the verify method.

Specified by:
verifySignature in interface SmimeSignedObject
Throws:
oracle.security.crypto.core.AuthenticationException - if the signature is not valid, or could not be verified for some reason (e.g., the algorithm identifier is unrecognized)
oracle.security.crypto.cms.UnknownSignerException - if no signature corresponding to the given certificate exists

verifySignature

public void verifySignature(oracle.security.crypto.cert.X509 signerCert,
                            javax.mail.Address[] senderAddresses)
                     throws oracle.security.crypto.core.AuthenticationException,
                            oracle.security.crypto.cms.UnknownSignerException
Description copied from interface: SmimeSignedObject
Does the same thing as SmimeSignedObject.verifySignature(X509), except that in addition, it checks to make sure that the email address in the given certificate is present in the specified list of sender addresses.

The list of sender addresses should be obtained by invoking the getFrom() method on the instance of javax.mail.Message which contains this object as its content.

Specified by:
verifySignature in interface SmimeSignedObject
Throws:
oracle.security.crypto.core.AuthenticationException
oracle.security.crypto.cms.UnknownSignerException

verify

public void verify(oracle.security.crypto.cert.CertificateTrustPolicy trustPolicy)
            throws oracle.security.crypto.core.AuthenticationException
Description copied from interface: SmimeSignedObject
Returns normally if this CMS signed data object contains at least one valid signature, according to the given trust policy; otherwise throws an AuthenticationException.

In order to be considered valid, there must be at least one signature on this CMS message which is validated by one of the certificates included with it; furthermore, the validating certificate must itself be valid according to the given certificate trust policy. This latter validation process may involve examining the other certificates or CRLs included with this object, if called for by the trust policy.

If a signature is encountered for which a certification path can be found, but is invalid, an AuthenticationException will be created, but will not be thrown until all other signatures have been checked. If another signature is found which is valid, then the method simply returns and no exception at all is thrown.

Specified by:
verify in interface SmimeSignedObject
Throws:
oracle.security.crypto.core.AuthenticationException - if there is no valid signature

verify

public void verify(oracle.security.crypto.cert.CertificateTrustPolicy trustPolicy,
                   javax.mail.Address[] senderAddresses)
            throws oracle.security.crypto.core.AuthenticationException
Description copied from interface: SmimeSignedObject
Does the same thing as SmimeSignedObject.verify(CertificateTrustPolicy), except that in addition, it checks to make sure that the terminating certificate of the validating certificate chain contains an email address which is present in the specified list of sender addresses.

The list of sender addresses should be obtained by invoking the getFrom() method on the instance of javax.mail.Message which contains this object as its content.

Specified by:
verify in interface SmimeSignedObject
Throws:
oracle.security.crypto.core.AuthenticationException

verifyReceipt

public void verifyReceipt(SmimeSignedObject originalSmimeSignedObject,
                          oracle.security.crypto.cert.X509 signerCert)
                   throws oracle.security.crypto.core.AuthenticationException
Stores the SignerInfo object that contains the original receipt request that will be used to validate a received receipt
Throws:
oracle.security.crypto.core.AuthenticationException

getESSSecurityLabel

public ESSSecurityLabel getESSSecurityLabel(oracle.security.crypto.cert.X509 signerCert)
                                     throws oracle.security.crypto.core.AuthenticationException,
                                            oracle.security.crypto.cms.UnknownSignerException
Returns the ESSSecurityLabel if present or null.

The signature of the SignerInfo that covers the ESSSecurityLabel is first verified. Then, it verifies that all the ESSSecurityLabel's in the signed message are identical.

Specified by:
getESSSecurityLabel in interface SmimeSignedObject
Returns:
A valid security label.
Throws:
oracle.security.crypto.core.AuthenticationException - Signature verification did not succeed on any SignerInfo.
oracle.security.crypto.cms.UnknownSignerException - No valid security label could be found.

getEquivalentLabels

public EquivalentLabels getEquivalentLabels(oracle.security.crypto.cert.X509 signerCert)
                                     throws oracle.security.crypto.core.AuthenticationException,
                                            oracle.security.crypto.cms.UnknownSignerException
Returns the EquivalentLabels if present or null.

The signature of the SignerInfo that covers the EquivalentLabels is first verified. Then, it verifies that all the EquivalentLabels in the signed message are identical.

Specified by:
getEquivalentLabels in interface SmimeSignedObject
Returns:
A valid equivalent labels.
Throws:
oracle.security.crypto.core.AuthenticationException - Signature verification did not succeed on any SignerInfo.
oracle.security.crypto.cms.UnknownSignerException - No valid equivalent labels could be found.

getSigningCertificate

public SigningCertificate getSigningCertificate(oracle.security.crypto.cert.X509 signerCert)
                                         throws oracle.security.crypto.core.AuthenticationException,
                                                oracle.security.crypto.cms.UnknownSignerException
Returns the SigningCertificate Attribute if present or null.

The signature of the SignerInfo that covers the SigningCertificate is verified.

Specified by:
getSigningCertificate in interface SmimeSignedObject
Returns:
A valid signing certificate.
Throws:
oracle.security.crypto.core.AuthenticationException - Signature verification did not succeed on any SignerInfo.
oracle.security.crypto.cms.UnknownSignerException - No valid signing certificate could be found.

getMLExpansionHistory

public MLExpansionHistory getMLExpansionHistory(oracle.security.crypto.cert.X509 signerCert)
                                         throws oracle.security.crypto.core.AuthenticationException,
                                                oracle.security.crypto.cms.UnknownSignerException
Returns the MLExpansionHistory if present or null.

The signature of the SignerInfo that covers the MLExpansionHistory is first verified. Then, it verifies that all the MLExpansionHistory's in the signed message are identical.

Specified by:
getMLExpansionHistory in interface SmimeSignedObject
Returns:
A valid mailing list expansion history.
Throws:
oracle.security.crypto.core.AuthenticationException - Signature verification did not succeed on any SignerInfo.
oracle.security.crypto.cms.UnknownSignerException - No valid mailing list expansion history could be found.

getReceiptRequest

public ReceiptRequest getReceiptRequest(oracle.security.crypto.cert.X509 signerCert)
                                 throws oracle.security.crypto.core.AuthenticationException,
                                        oracle.security.crypto.cms.UnknownSignerException
Returns the ReceiptRequest if present or null.

NOTE: RFC 2634 prohibits the presence of a ReceiptRequest attribute in a signed receipt.

The signature of the SignerInfo that covers the ReceiptRequest is first verified. Then, it verifies that all the ReceiptRequest's in the signed message are identical.

Specified by:
getReceiptRequest in interface SmimeSignedObject
Returns:
A valid receipt request.
Throws:
oracle.security.crypto.core.AuthenticationException - Signature verification did not succeed on any SignerInfo.
oracle.security.crypto.cms.UnknownSignerException - No valid receipt request could be found.

generateContentType

public java.lang.String generateContentType(boolean useStandardContentTypes)
Description copied from interface: SmimeObject
Returns the content type of this smime object.
Specified by:
generateContentType in interface SmimeObject
Parameters:
useStandardContentTypes - If true the standard content type is generated; If false the experimental content type is generated.
Returns:
The content type string.

generateContentType

public java.lang.String generateContentType()
Description copied from interface: SmimeObject
Returns the content type of this smime object.
Specified by:
generateContentType in interface SmimeObject
Returns:
The content type string.

writeTo

public void writeTo(java.io.OutputStream os,
                    java.lang.String mimeType)
             throws java.io.IOException,
                    javax.mail.MessagingException
Writes this SmimeSigned to the given output stream. Relevant canonicalizations, such as transforming text line-breaks to CRLF, are applied.
Specified by:
writeTo in interface SmimeObject
Parameters:
os - The output stream to which this SmimeEnveloped will be written.
mimeType - Ignored.
Throws:
javax.mail.MessagingException - An error occurred while writing the smime message.
java.io.IOException - An I/O error occurred.

Oracle Security Developer Tools S/MIME Java API Reference
10g (10.1.4.0.1)

B28172-01


Copyright © 2005 ,2006 , Oracle. All rights reserved.