Skip navigation links

Oracle Fusion Middleware S/MIME Java API Reference for Oracle Security Developer Tools
11g Release 1 (11.1.1)

E10672-05


oracle.security.crypto.smime
Class SmimeMultipartSigned

java.lang.Object
  extended by MimeMultipart
      extended by oracle.security.crypto.smime.SmimeMultipartSigned

All Implemented Interfaces:
SmimeObject, SmimeSignedObject

public class SmimeMultipartSigned
extends 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.


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

 

Method Summary
 void addCertificate(java.security.cert.X509Certificate cert)
          Add a Certificate.
 void addCRL(oracle.security.crypto.cert.CRL crl)
          Add a CRL.
 void addSignature(java.security.PrivateKey signerKey, java.security.cert.X509Certificate signerCert)
          Add a Signature.
 void addSignature(java.security.PrivateKey signerKey, java.security.cert.X509Certificate signerCert, oracle.security.crypto.core.AlgorithmIdentifier digestAlgID, oracle.security.crypto.cert.AttributeSet signedAttributes)
          Add a Signature.
 void addSignature(java.security.PrivateKey signerKey, java.security.cert.X509Certificate signerCert, java.util.Date timeStamp)
          Add a Signature.
 void addSignature(java.security.PrivateKey signerKey, java.security.cert.X509Certificate signerCert, java.util.Date timeStamp, SmimeCapabilities smimeCaps)
          Add a Signature.
 void addSignature(java.security.PrivateKey signerKey, java.security.cert.X509Certificate 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.
 MimeBodyPart getEnclosedBodyPart()
          Returns the message content that was signed.
 EquivalentLabels getEquivalentLabels(java.security.cert.X509Certificate signerCert)
          Returns the EquivalentLabels if present or null.
 ESSSecurityLabel getESSSecurityLabel(java.security.cert.X509Certificate signerCert)
          Returns the ESSSecurityLabel if present or null.
 MLExpansionHistory getMLExpansionHistory(java.security.cert.X509Certificate signerCert)
          Returns the MLExpansionHistory attribute if present or null.
 ReceiptRequest getReceiptRequest(java.security.cert.X509Certificate signerCert)
          Returns the ReceiptRequest attribute if present or null.
 SigningCertificate getSigningCertificate(java.security.cert.X509Certificate 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, Address[] senderAddresses)
          Verify the Signature using the specified trust policy and list of email addresses.
 void verifySignature(java.security.cert.X509Certificate signerCert)
          Verify the Signature using the specified certificate.
 void verifySignature(java.security.cert.X509Certificate signerCert, 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

SmimeMultipartSigned

public SmimeMultipartSigned(MimeBodyPart bodyPart,
                            oracle.security.crypto.core.AlgorithmIdentifier digestAlgID)
                     throws 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:
MessagingException - An error occurred while setting the message content.

SmimeMultipartSigned

public SmimeMultipartSigned(javax.activation.DataSource ds)
                     throws 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.
MessagingException - An error occurred while initializing the message content.

Method Detail

addSignature

public void addSignature(java.security.PrivateKey signerKey,
                         java.security.cert.X509Certificate signerCert)
                  throws java.security.NoSuchAlgorithmException,
                         java.security.InvalidKeyException,
                         java.io.IOException,
                         java.security.cert.CertificateEncodingException,
                         java.security.SignatureException
Add a Signature.

Note the changes in the method signature

Previously : public void addSignature (oracle.security.crypto.core.PrivateKey, X509 )

Now : public void addSignature (java.security.PrivateKey, X509Certificate )

Note the changes in the exceptions

Exceptions introduced -- NoSuchAlgorithmException,IOException,CertificateEncodingException,java.security.InvalidKeyException, java.security.SignatureException

Exceptions no longer thrown-- AlgorithmIdentifierException , oracle.security.crypto.core.InvalidKeyException, oracle.security.crypto.core.signatureException

Parameters:
signerKey - The private key of the signer.
signerCert - The X509 certificate of the signer.
Throws:
java.security.NoSuchAlgorithmException - Algorithm is not supported.
java.security.InvalidKeyException - Private Key format is not valid.
java.security.SignatureException - An error occurred while adding the signature.
java.security.cert.CertificateEncodingException - Specifies an encoding error
java.io.IOException - Input/Output Exception while instantiating X509 from an inputstream

addSignature

public void addSignature(java.security.PrivateKey signerKey,
                         java.security.cert.X509Certificate signerCert,
                         java.util.Date timeStamp)
                  throws java.security.NoSuchAlgorithmException,
                         java.security.InvalidKeyException,
                         java.security.SignatureException,
                         java.io.IOException,
                         java.security.cert.CertificateEncodingException
Add a Signature.

Note the changes in the method signature

Previously : public void addSignature (oracle.security.crypto.core.PrivateKey, X509,Date )

Now : public void addSignature (java.security.PrivateKey, X509Certificate ,Date )/

Note the changes in the exceptions

Exceptions introduced -- NoSuchAlgorithmException,IOException,CertificateEncodingException,java.security.InvalidKeyException, java.security.SignatureException

Exceptions no longer thrown-- AlgorithmIdentifierException , oracle.security.crypto.core.InvalidKeyException, oracle.security.crypto.core.signatureException

Parameters:
signerKey - The private key of the signer.
signerCert - The X509 certificate of the signer.
timeStamp - The signingTime attriibute value.
Throws:
java.security.NoSuchAlgorithmException - Algorithm is not supported.
java.security.InvalidKeyException - Private Key format is not valid.
java.security.SignatureException - An error occurred while adding the signature.
java.security.cert.CertificateEncodingException - Specifies an encoding error
java.io.IOException - Input/Output Exception while instantiating X509 from an inputstream

addSignature

public void addSignature(java.security.PrivateKey signerKey,
                         java.security.cert.X509Certificate signerCert,
                         SmimeCapabilities smimeCaps)
                  throws java.security.NoSuchAlgorithmException,
                         java.security.InvalidKeyException,
                         java.security.SignatureException,
                         java.io.IOException,
                         java.security.cert.CertificateEncodingException
Add a Signature.

Note the changes in the method signature

Previously : public void addSignature (oracle.security.crypto.core.PrivateKey, X509,SmimeCapabilities )

Now : public void addSignature (java.security.PrivateKey, X509Certificate ,SmimeCapabilities )

Note the changes in the exceptions

Exceptions introduced -- NoSuchAlgorithmException,IOException,CertificateEncodingException,java.security.InvalidKeyException, java.security.SignatureException

Exceptions no longer thrown-- AlgorithmIdentifierException , oracle.security.crypto.core.InvalidKeyException, oracle.security.crypto.core.signatureException

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:
java.security.NoSuchAlgorithmException - Algorithm is not supported.
java.security.InvalidKeyException - Private Key format is not valid.
java.security.SignatureException - An error occurred while adding the signature.
java.security.cert.CertificateEncodingException - Specifies an encoding error
java.io.IOException - Input/Output Exception while instantiating X509 from an inputstream

addSignature

public void addSignature(java.security.PrivateKey signerKey,
                         java.security.cert.X509Certificate signerCert,
                         java.util.Date timeStamp,
                         SmimeCapabilities smimeCaps)
                  throws java.security.NoSuchAlgorithmException,
                         java.security.InvalidKeyException,
                         java.security.SignatureException,
                         java.io.IOException,
                         java.security.cert.CertificateEncodingException
Add a Signature.

Note the changes in the method signature

Previously : public void addSignature (oracle.security.crypto.core.PrivateKey, X509,Date,SmimeCapabilities )

Now : public void addSignature (java.security.PrivateKey, X509Certificate ,Date,SmimeCapabilities )

Note the changes in the exceptions

Exceptions introduced -- NoSuchAlgorithmException,IOException,CertificateEncodingException,java.security.InvalidKeyException, java.security.SignatureException

Exceptions no longer thrown-- AlgorithmIdentifierException , oracle.security.crypto.core.InvalidKeyException, oracle.security.crypto.core.signatureException

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:
java.security.NoSuchAlgorithmException - Algorithm is not supported.
java.security.InvalidKeyException - Private Key format is not valid.
java.security.SignatureException - An error occurred while adding the signature.
java.security.cert.CertificateEncodingException - Specifies an encoding error
java.io.IOException - Input/Output Exception while instantiating X509 from an inputstream

addSignature

public void addSignature(java.security.PrivateKey signerKey,
                         java.security.cert.X509Certificate signerCert,
                         oracle.security.crypto.core.AlgorithmIdentifier digestAlgID,
                         oracle.security.crypto.cert.AttributeSet signedAttributes)
                  throws java.security.NoSuchAlgorithmException,
                         java.security.InvalidKeyException,
                         java.security.SignatureException,
                         java.io.IOException,
                         java.security.cert.CertificateEncodingException
Add a Signature.

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

Note the changes in the method signature

Previously : public void addSignature (oracle.security.crypto.core.PrivateKey, X509,AlgorithmIdentifier,AtrributeSet)

Now : public void addSignature (java.security.PrivateKey, X509Certificate ,AlgorithmIdentifier,AtrributeSet)

Note the changes in the exceptions

Exceptions introduced -- NoSuchAlgorithmException,IOException,CertificateEncodingException,java.security.InvalidKeyException, java.security.SignatureException

Exceptions no longer thrown-- AlgorithmIdentifierException , oracle.security.crypto.core.InvalidKeyException, oracle.security.crypto.core.signatureException

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.
java.security.InvalidKeyException - Private Key format is not valid.
java.security.SignatureException - An error occurred while adding the signature.
java.security.cert.CertificateEncodingException - Specifies an encoding error
java.io.IOException - Input/Output Exception while instantiating X509 from an inputstream
java.security.NoSuchAlgorithmException

addCertificate

public void addCertificate(java.security.cert.X509Certificate cert)
Add a Certificate.

Note the changes in the method signature

Previously : public void addCertificate (X509)

Now : public void addCertificate (X509Certificate )

Parameters:
cert - The X509 certificate.

addCRL

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

getEnclosedBodyPart

public MimeBodyPart getEnclosedBodyPart()
                                 throws oracle.security.crypto.util.InvalidInputException,
                                        MessagingException
Returns the message content that was signed.
Specified by:
getEnclosedBodyPart in interface SmimeSignedObject
Returns:
The message content as a MimeBodyPart.
Throws:
oracle.security.crypto.util.InvalidInputException - The message content type is not correct.
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(java.security.cert.X509Certificate signerCert)
                     throws oracle.security.crypto.core.AuthenticationException,
                            java.security.SignatureException
Verify the Signature using the specified certificate.

Note the changes in the method signature

Previously : public void addCertificate (X509)

Now : public void addCertificate (X509Certificate )

Specified by:
verifySignature in interface SmimeSignedObject
Parameters:
signerCert - The X509 certificate.
Throws:
oracle.security.crypto.core.AuthenticationException - Signature verification failed.
java.security.SignatureException - The specified certificate does not belong to any of the message signers.

verifySignature

public void verifySignature(java.security.cert.X509Certificate signerCert,
                            Address[] senderAddresses)
                     throws oracle.security.crypto.core.AuthenticationException,
                            java.security.SignatureException
Verify the Signature using the specified certificate and list of email addresses.

Note the changes in the method signature

Previously : public void verifySignature (X509, Address[] )

Now :public void verifySignature (X509Certificate , Address[])

Specified by:
verifySignature in interface SmimeSignedObject
Parameters:
signerCert - The X509 certificate.
Throws:
oracle.security.crypto.core.AuthenticationException - Signature verification failed or the email address in the certificate did not match any in the email address list.
java.security.SignatureException - The specified certificate does not belong to any of the message signers.

verify

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

verify

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

getESSSecurityLabel

public ESSSecurityLabel getESSSecurityLabel(java.security.cert.X509Certificate signerCert)
                                     throws oracle.security.crypto.core.AuthenticationException,
                                            java.security.SignatureException
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.

Note the changes in the method signature

Previously : public ESSSecurityLabel getESSSecurityLabel(X509)

Now :public ESSSecurityLabel getESSSecurityLabel(X509Certificate)

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.
java.security.SignatureException - No valid security label could be found.

getEquivalentLabels

public EquivalentLabels getEquivalentLabels(java.security.cert.X509Certificate signerCert)
                                     throws oracle.security.crypto.core.AuthenticationException,
                                            java.security.SignatureException
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.

Note the changes in the method signature

Previously : public EquivalentLabels getEquivalentLabels(X509)

Now : public EquivalentLabels getEquivalentLabels(X509Certificate)

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.
java.security.SignatureException - No valid equivalent labels could be found.

getSigningCertificate

public SigningCertificate getSigningCertificate(java.security.cert.X509Certificate signerCert)
                                         throws oracle.security.crypto.core.AuthenticationException,
                                                java.security.SignatureException
Returns the SigningCertificate Attribute if present or null.

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

Note the changes in the method signature

Previously : public SigningCertificate getSigningCertificate (X509)

Now : public SigningCertificate getSigningCertificate (X509Certificate)

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.
java.security.SignatureException - No valid signing certificate could be found.

getMLExpansionHistory

public MLExpansionHistory getMLExpansionHistory(java.security.cert.X509Certificate signerCert)
                                         throws oracle.security.crypto.core.AuthenticationException,
                                                java.security.SignatureException
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.

Note the changes in the method signature

Previously : public MLExpansionHistory getMLExpansionHistory(X509)

Now : public MLExpansionHistory getMLExpansionHistory(X509Certificate )

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.
java.security.SignatureException - No valid mailing list expansion history could be found.

getReceiptRequest

public ReceiptRequest getReceiptRequest(java.security.cert.X509Certificate signerCert)
                                 throws oracle.security.crypto.core.AuthenticationException,
                                        java.security.SignatureException
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.

Note the changes in the method signature

Previously : public ReceiptRequest getReceiptRequest (X509)

Now : public ReceiptRequest getReceiptRequest (X509Certificate )

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.
java.security.SignatureException - 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,
                    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:
java.io.IOException - An I/O error occurred.
MessagingException - An error occurred while writing the smime message.

Skip navigation links

Oracle Fusion Middleware S/MIME Java API Reference for Oracle Security Developer Tools
11g Release 1 (11.1.1)

E10672-05


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