Oracle Security Developer Tools S/MIME Java API Reference
10g Release 2 (10.1.2.0.2)

B15567-01


oracle.security.crypto.smime
Class SmimeMultipartSigned

java.lang.Object
  extended byjavax.mail.Multipart
      extended byjavax.mail.internet.MimeMultipart
          extended byoracle.security.crypto.smime.SmimeMultipartSigned

All Implemented Interfaces:
SmimeObject, SmimeSignedObject

public class SmimeMultipartSigned
extends javax.mail.internet.MimeMultipart
implements SmimeSignedObject

A S/MIME Multipart Signed Message. A multipart signed message is intended for email clients that are not MIME aware.

Please do not create wrapped messages containing a multipart signed message.


Field Summary

Fields inherited from class javax.mail.internet.MimeMultipart
ds, parsed

Fields inherited from class javax.mail.Multipart
contentType, parent, parts

Constructor Summary
SmimeMultipartSigned(javax.activation.DataSource ds)
Create a new SmimeMultipartSigned by reading from a DataSource.
SmimeMultipartSigned(javax.mail.internet.MimeBodyPart bodyPart, AlgorithmIdentifier digestAlgID)
Create a new SmimeMultipartSigned with the given body and algorithm identifier.

Method Summary
void addCertificate(oracle.security.crypto.cert.X509 cert)
Add a Certificate.
void addCRL(oracle.security.crypto.cert.CRL crl)
Add a CRL.
void addSignature(PrivateKey signerKey, oracle.security.crypto.cert.X509 signerCert)
Add a Signature.
void addSignature(PrivateKey signerKey, oracle.security.crypto.cert.X509 signerCert, AlgorithmIdentifier digestAlgID, oracle.security.crypto.cert.AttributeSet signedAttributes)
Add a Signature.
void addSignature(PrivateKey signerKey, oracle.security.crypto.cert.X509 signerCert, java.util.Date timeStamp)
Add a Signature.
void addSignature(PrivateKey signerKey, oracle.security.crypto.cert.X509 signerCert, java.util.Date timeStamp, SmimeCapabilities smimeCaps)
Add a Signature.
void addSignature(PrivateKey signerKey, oracle.security.crypto.cert.X509 signerCert, SmimeCapabilities smimeCaps)
Add a Signature.
java.lang.String generateContentType()
Returns the content type.
java.lang.String generateContentType(boolean useStandardContentTypes)
Returns the content type.
java.util.Vector getCertificates()
Returns the list of X509 certificates included with this signed data object.
java.lang.String getContentType()
Returns the content type.
java.util.Vector getCRLs()
Returns the list of CRLs included with this signed data object.
javax.mail.internet.MimeBodyPart getEnclosedBodyPart()
Returns the message content that was signed.
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 attribute if present or null.
ReceiptRequest getReceiptRequest(oracle.security.crypto.cert.X509 signerCert)
Returns the ReceiptRequest attribute if present or null.
SigningCertificate getSigningCertificate(oracle.security.crypto.cert.X509 signerCert)
Returns the SigningCertificate Attribute if present or null.
java.util.Enumeration signers()
Returns the list of signers.
protected void updateHeaders()
void verify(oracle.security.crypto.cert.CertificateTrustPolicy trustPolicy)
Verify the Signature using the specified trust policy.
void verify(oracle.security.crypto.cert.CertificateTrustPolicy trustPolicy, javax.mail.Address[] senderAddresses)
Verify the Signature using the specified trust policy and list of email addresses.
void verifySignature(oracle.security.crypto.cert.X509 signerCert)
Verify the Signature using the specified certificate.
void verifySignature(oracle.security.crypto.cert.X509 signerCert, javax.mail.Address[] senderAddresses)
Verify the Signature using the specified certificate and list of email addresses.
void writeTo(java.io.OutputStream os, java.lang.String contentType)
Writes this SmimeMultipartSigned to the given output stream.

Methods inherited from class javax.mail.internet.MimeMultipart
createInternetHeaders, createMimeBodyPart, createMimeBodyPart, getBodyPart, getBodyPart, getCount, parse, setSubType, writeTo

Methods inherited from class javax.mail.Multipart
addBodyPart, addBodyPart, getParent, removeBodyPart, removeBodyPart, setMultipartDataSource, setParent

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

Constructor Detail

SmimeMultipartSigned

public SmimeMultipartSigned(javax.mail.internet.MimeBodyPart bodyPart,
                            AlgorithmIdentifier digestAlgID)
                     throws javax.mail.MessagingException
Create a new SmimeMultipartSigned with the given body and algorithm identifier. Relevant canonicalizations, such as transforming text line-breaks to CRLF, are applied to the body.
Parameters:
bodyPart - The message content.
digestAlgID - The digest algorithm.
Throws:
javax.mail.MessagingException - An error occurred while setting the message content.

SmimeMultipartSigned

public SmimeMultipartSigned(javax.activation.DataSource ds)
                     throws javax.mail.MessagingException,
                            java.io.IOException
Create a new SmimeMultipartSigned by reading from a DataSource.
Parameters:
ds - The data source.
Throws:
java.io.IOException - An I/O error error occurred or the message format is not correct.
javax.mail.MessagingException - An error occurred while initializing the message content.

Method Detail

addSignature

public void addSignature(PrivateKey signerKey,
                         oracle.security.crypto.cert.X509 signerCert)
                  throws AlgorithmIdentifierException,
                         InvalidKeyException,
                         SignatureException
Add a Signature.
Parameters:
signerKey - The private key of the signer.
signerCert - The X509 certificate of the signer.
Throws:
AlgorithmIdentifierException - Algorithm is not supported.
InvalidKeyException - Private Key format is not valid.
SignatureException - An error occurred while adding the signature.

addSignature

public void addSignature(PrivateKey signerKey,
                         oracle.security.crypto.cert.X509 signerCert,
                         java.util.Date timeStamp)
                  throws AlgorithmIdentifierException,
                         InvalidKeyException,
                         SignatureException
Add a Signature.
Parameters:
signerKey - The private key of the signer.
signerCert - The X509 certificate of the signer.
timeStamp - The signingTime attriibute value.
Throws:
AlgorithmIdentifierException - Algorithm is not supported.
InvalidKeyException - Private Key format is not valid.
SignatureException - An error occurred while adding the signature.

addSignature

public void addSignature(PrivateKey signerKey,
                         oracle.security.crypto.cert.X509 signerCert,
                         SmimeCapabilities smimeCaps)
                  throws AlgorithmIdentifierException,
                         InvalidKeyException,
                         SignatureException
Add a Signature.
Parameters:
signerKey - The private key of the signer.
signerCert - The X509 certificate of the signer.
smimeCaps - The SmimeCapabilities attribute value.
Throws:
AlgorithmIdentifierException - Algorithm is not supported.
InvalidKeyException - Private Key format is not valid.
SignatureException - An error occurred while adding the signature.

addSignature

public void addSignature(PrivateKey signerKey,
                         oracle.security.crypto.cert.X509 signerCert,
                         java.util.Date timeStamp,
                         SmimeCapabilities smimeCaps)
                  throws AlgorithmIdentifierException,
                         InvalidKeyException,
                         SignatureException,
                         javax.mail.MessagingException
Add a Signature.
Parameters:
signerKey - The private key of the signer.
signerCert - The X509 certificate of the signer.
timeStamp - The signingTime attriibute value.
smimeCaps - The SmimeCapabilities attribute value.
Throws:
AlgorithmIdentifierException - Algorithm is not supported.
InvalidKeyException - Private Key format is not valid.
SignatureException - An error occurred while adding the signature.
javax.mail.MessagingException

addSignature

public void addSignature(PrivateKey signerKey,
                         oracle.security.crypto.cert.X509 signerCert,
                         AlgorithmIdentifier digestAlgID,
                         oracle.security.crypto.cert.AttributeSet signedAttributes)
                  throws AlgorithmIdentifierException,
                         InvalidKeyException,
                         SignatureException,
                         javax.mail.MessagingException
Add a Signature.

The contentType and messageDigest must not be present in the AttributeSet signedAttributes.

Parameters:
signerKey - The private key of the signer.
signerCert - The X509 certificate of the signer.
signedAttributes - The set of Signed Attributes.
Throws:
AlgorithmIdentifierException - Algorithm is not supported.
InvalidKeyException - Private Key format is not valid.
SignatureException - An error occurred while adding the signature.
javax.mail.MessagingException

addCertificate

public void addCertificate(oracle.security.crypto.cert.X509 cert)
Add a Certificate.
Parameters:
cert - The X509 certificate.

addCRL

public void addCRL(oracle.security.crypto.cert.CRL crl)
Add a CRL.
Parameters:
crl - The CRL.

getEnclosedBodyPart

public javax.mail.internet.MimeBodyPart getEnclosedBodyPart()
                                                     throws InvalidInputException,
                                                            javax.mail.MessagingException
Returns the message content that was signed.
Specified by:
getEnclosedBodyPart in interface SmimeSignedObject
Returns:
The message content as a MimeBodyPart.
Throws:
InvalidInputException - The message content type is not correct.
javax.mail.MessagingException - An error occurred while initializing the content.

signers

public java.util.Enumeration signers()
Returns the list of signers.
Specified by:
signers in interface SmimeSignedObject
Returns:
A Vector containing CMSSignerInfo objects.

getCertificates

public java.util.Vector getCertificates()
Returns the list of X509 certificates included with this signed data object.
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.
Specified by:
getCRLs in interface SmimeSignedObject
Returns:
A Vector containing CRL objects or null if no list of CRLs is present.

verifySignature

public void verifySignature(oracle.security.crypto.cert.X509 signerCert)
                     throws AuthenticationException,
                            oracle.security.crypto.cms.UnknownSignerException
Verify the Signature using the specified certificate.
Specified by:
verifySignature in interface SmimeSignedObject
Parameters:
signerCert - The X509 certificate.
Throws:
AuthenticationException - Signature verification failed.
oracle.security.crypto.cms.UnknownSignerException - The specified certificate does not belong to any of the message signers.

verifySignature

public void verifySignature(oracle.security.crypto.cert.X509 signerCert,
                            javax.mail.Address[] senderAddresses)
                     throws AuthenticationException,
                            oracle.security.crypto.cms.UnknownSignerException
Verify the Signature using the specified certificate and list of email addresses.
Specified by:
verifySignature in interface SmimeSignedObject
Parameters:
signerCert - The X509 certificate.
Throws:
AuthenticationException - Signature verification failed or the email address in the certificate did not match any in the email address list.
oracle.security.crypto.cms.UnknownSignerException - The specified certificate does not belong to any of the message signers.

verify

public void verify(oracle.security.crypto.cert.CertificateTrustPolicy trustPolicy)
            throws AuthenticationException
Verify the Signature using the specified trust policy.
Specified by:
verify in interface SmimeSignedObject
Parameters:
trustPolicy - The certificate trust policy.
Throws:
AuthenticationException - Signature verification failed.

verify

public void verify(oracle.security.crypto.cert.CertificateTrustPolicy trustPolicy,
                   javax.mail.Address[] senderAddresses)
            throws AuthenticationException
Verify the Signature using the specified trust policy and list of email addresses.
Specified by:
verify in interface SmimeSignedObject
Throws:
AuthenticationException - Signature verification failed or the email address in the certificate did not match any in the email address list.

getESSSecurityLabel

public ESSSecurityLabel getESSSecurityLabel(oracle.security.crypto.cert.X509 signerCert)
                                     throws 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 ESSSecurityLabels in the signed message are identical.

Specified by:
getESSSecurityLabel in interface SmimeSignedObject
Returns:
A valid security label.
Throws:
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 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 EquivalentLabel's in the signed message are identical.

Specified by:
getEquivalentLabels in interface SmimeSignedObject
Returns:
A valid equivalent labels.
Throws:
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 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:
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 AuthenticationException,
                                                oracle.security.crypto.cms.UnknownSignerException
Returns the MLExpansionHistory attribute 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:
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 AuthenticationException,
                                        oracle.security.crypto.cms.UnknownSignerException
Returns the ReceiptRequest attribute if present or null.

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:
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)
Returns the content type.
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()
Returns the content type.
Specified by:
generateContentType in interface SmimeObject
Returns:
The content type string.

getContentType

public java.lang.String getContentType()
Returns the content type.
Returns:
The content type string.

updateHeaders

protected void updateHeaders()

writeTo

public void writeTo(java.io.OutputStream os,
                    java.lang.String contentType)
             throws java.io.IOException,
                    javax.mail.MessagingException
Writes this SmimeMultipartSigned to the given output stream.
Specified by:
writeTo in interface SmimeObject
Parameters:
os - The output stream to which this SmimeMultipartSigned will be written.
contentType - The content type for this SmimeMultipartSigned.
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 Release 2 (10.1.2.0.2)

B15567-01


Copyright © 2005 , Oracle. All rights reserved.