Skip navigation links

Oracle Security Developer Tools S/MIME Java API Reference
11g (11.1.1)

E10672-02


oracle.security.crypto.smime
Class SmimeEnveloped

java.lang.Object
  extended by oracle.security.crypto.smime.SmimeEnveloped

All Implemented Interfaces:
SmimeObject

public class SmimeEnveloped
extends java.lang.Object
implements SmimeObject

A S/MIME Enveloped Message.


Constructor Summary
SmimeEnveloped(java.io.InputStream is)
          Create a SmimeEnveloped.
SmimeEnveloped(MimeBodyPart content, oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID)
          Create a SmimeEnveloped.

 

Method Summary
 void addRecipient(java.security.cert.X509Certificate cert)
          Add a Recipient.
 void addRecipient(java.security.cert.X509Certificate cert, oracle.security.crypto.core.AlgorithmIdentifier keyEncryptionAlgID)
          Add a Recipient.
 java.lang.String generateContentType()
          Returns the content type.
 java.lang.String generateContentType(boolean useStandardContentTypes)
          Returns the content type.
 oracle.security.crypto.core.AlgorithmIdentifier getContentEncryptionAlgID()
          Returns the content encryption algorithm.
 MimeBodyPart getEnclosedBodyPart(java.security.PrivateKey recipientKey, java.security.cert.X509Certificate recipientCert)
          Returns the Decrypted Content.
 byte[] getEncryptedContent()
          Returns the raw content (that is, without decrypting).
 java.util.Enumeration recipients()
          Returns the message recipients.
 void writeTo(java.io.OutputStream os, java.lang.String mimeType)
          Writes this SmimeEnveloped 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

SmimeEnveloped

public SmimeEnveloped(MimeBodyPart content,
                      oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID)
               throws MessagingException,
                      java.io.IOException
Create a SmimeEnveloped.
Parameters:
content - The message content.
contentEncryptionAlgID - The content encryption algorithm identifier.
Throws:
MessagingException - An error occurred while setting the message content.
java.io.IOException

SmimeEnveloped

public SmimeEnveloped(java.io.InputStream is)
               throws java.io.IOException
Create a SmimeEnveloped.
Parameters:
is - The input stream.
Throws:
java.io.IOException - The input encoding is incorrect or an I/O error occurred.

Method Detail

getEnclosedBodyPart

public MimeBodyPart getEnclosedBodyPart(java.security.PrivateKey recipientKey,
                                        java.security.cert.X509Certificate recipientCert)
                                 throws java.security.NoSuchAlgorithmException,
                                        java.security.InvalidKeyException,
                                        oracle.security.crypto.cms.UnknownRecipientException,
                                        java.io.IOException,
                                        java.security.cert.CertificateEncodingException,
                                        oracle.security.crypto.util.InvalidInputException,
                                        MessagingException,
                                        javax.crypto.BadPaddingException,
                                        javax.crypto.IllegalBlockSizeException,
                                        javax.crypto.NoSuchPaddingException
Returns the Decrypted Content.

Note the changes in the exceptions

Exceptions no longer thrown - AlgorithmIdentifierException,CipherException

Exceptions introduced - IOException,CertificateEncodingException, NoSuchAlgorithmException,BadPaddingException, IllegalBlockSizeException,NoSuchPaddingException

Parameters:
recipientKey - The private key of the recipient.
recipientCert - The X509 certificate of the recipient.
Throws:
java.security.NoSuchAlgorithmException - The content encryption algorithm is not supported.
java.security.InvalidKeyException - The private key is not valid.
javax.crypto.BadPaddingException - Expected padding mechanism not found.
javax.crypto.IllegalBlockSizeException - Data not multiple of the block size
javax.crypto.NoSuchPaddingException - Requested Padding Mechanism not supported
oracle.security.crypto.util.InvalidInputException - The message content type is incorrect.
MessagingException - An error occurred while setting the decrypted content.
oracle.security.crypto.cms.UnknownRecipientException - The key pair does not belong to message recipient.
java.security.cert.CertificateEncodingException - Specifies an encoding error
java.io.IOException - Input/Output Exception while instantiating X509 from an inputstream

getContentEncryptionAlgID

public oracle.security.crypto.core.AlgorithmIdentifier getContentEncryptionAlgID()
Returns the content encryption algorithm.
Returns:
The encryption algorithm identifier.

recipients

public java.util.Enumeration recipients()
Returns the message recipients.
Returns:
An Enumeration of CMSRecipientInfo objects.

getEncryptedContent

public byte[] getEncryptedContent()
Returns the raw content (that is, without decrypting).
Returns:
The encrypted content.

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.

addRecipient

public void addRecipient(java.security.cert.X509Certificate cert)
                  throws java.security.NoSuchAlgorithmException,
                         javax.crypto.IllegalBlockSizeException,
                         javax.crypto.BadPaddingException,
                         javax.crypto.NoSuchPaddingException,
                         java.security.InvalidKeyException,
                         java.security.cert.CertificateEncodingException,
                         java.io.IOException
Add a Recipient.
Parameters:
cert - The X509 public key certificate.

Note the changes in the method signature

Previously : public void addRecipient (X509)

Now : public void addRecipient (X509Certificate )

Note the changes in the exceptions

Exceptions no longer thrown - AlgorithmIdentifierException,CipherException

Exceptions introduced - IOException,CertificateEncodingException, NoSuchAlgorithmException, IllegalBlockSizeException,BadPaddingException,NoSuchPaddingException

Throws:
java.security.NoSuchAlgorithmException - The content encryption algorithm is not supported.
javax.crypto.BadPaddingException - Expected padding mechanism not found.
javax.crypto.IllegalBlockSizeException - Data not multiple of the block size
javax.crypto.NoSuchPaddingException - Requested Padding Mechanism not supported
java.security.cert.CertificateEncodingException - Specifies an encoding error
java.io.IOException - Input/Output Exception while instantiating X509 rom an inputstream
java.security.InvalidKeyException - The key is invalid

addRecipient

public void addRecipient(java.security.cert.X509Certificate cert,
                         oracle.security.crypto.core.AlgorithmIdentifier keyEncryptionAlgID)
                  throws java.security.NoSuchAlgorithmException,
                         javax.crypto.NoSuchPaddingException,
                         javax.crypto.IllegalBlockSizeException,
                         javax.crypto.BadPaddingException,
                         java.security.InvalidKeyException,
                         java.security.cert.CertificateEncodingException,
                         java.io.IOException
Add a Recipient.

Note the changes in the method signature

Previously : public void addRecipient (X509 ,AlgorithmIdentifier)

Now : public void addRecipient (X509Certificate ,AlgorithmIdentifier)

Note the changes in the exceptions

Exceptions no longer thrown - AlgorithmIdentifierException,CipherException

Exceptions introduced - IOException,CertificateEncodingException, NoSuchAlgorithmException, NoSuchPaddingException,IllegalBlockSizeException,BadPaddingException

Parameters:
cert - The X509 public key certificate.
keyEncryptionAlgID - The key transport algorithm.
Throws:
java.security.NoSuchAlgorithmException - The content encryption algorithm is not supported.
javax.crypto.BadPaddingException - Expected padding mechanism not found.
javax.crypto.IllegalBlockSizeException - Data not multiple of the block size
javax.crypto.NoSuchPaddingException - Requested Padding Mechanism not supported
java.security.InvalidKeyException - Invalid key for encryption
java.security.cert.CertificateEncodingException - Specifies an encoding error
java.io.IOException - Input/Output Exception while instantiating X509 from an inputstream

writeTo

public void writeTo(java.io.OutputStream os,
                    java.lang.String mimeType)
             throws java.io.IOException,
                    MessagingException
Writes this SmimeEnveloped 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:
java.io.IOException - An I/O error occurred.
MessagingException - An error occurred while creating the smime message.

Skip navigation links

Oracle Security Developer Tools S/MIME Java API Reference
11g (11.1.1)

E10672-02


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