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

B15567-01


oracle.security.crypto.smime
Class SmimeEnveloped

java.lang.Object
  extended byoracle.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(javax.mail.internet.MimeBodyPart content, AlgorithmIdentifier contentEncryptionAlgID)
Create a SmimeEnveloped.

Method Summary
void addRecipient(oracle.security.crypto.cert.X509 cert)
Add a Recipient.
void addRecipient(oracle.security.crypto.cert.X509 cert, AlgorithmIdentifier keyEncryptionAlgID)
Add a Recipient.
java.lang.String generateContentType()
Returns the content type.
java.lang.String generateContentType(boolean useStandardContentTypes)
Returns the content type.
AlgorithmIdentifier getContentEncryptionAlgID()
Returns the content encryption algorithm.
javax.mail.internet.MimeBodyPart getEnclosedBodyPart(PrivateKey recipientKey, oracle.security.crypto.cert.X509 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(javax.mail.internet.MimeBodyPart content,
                      AlgorithmIdentifier contentEncryptionAlgID)
               throws javax.mail.MessagingException,
                      java.io.IOException
Create a SmimeEnveloped.
Parameters:
content - The message content.
contentEncryptionAlgID - The content encryption algorithm identifier.
Throws:
javax.mail.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 javax.mail.internet.MimeBodyPart getEnclosedBodyPart(PrivateKey recipientKey,
                                                            oracle.security.crypto.cert.X509 recipientCert)
                                                     throws AlgorithmIdentifierException,
                                                            InvalidKeyException,
                                                            CipherException,
                                                            oracle.security.crypto.cms.UnknownRecipientException,
                                                            InvalidInputException,
                                                            javax.mail.MessagingException
Returns the Decrypted Content.
Parameters:
recipientKey - The private key of the recipient.
recipientCert - The X509 certificate of the recipient.
Throws:
AlgorithmIdentifierException - The content encryption algorithm is not supported.
InvalidKeyException - The private key is not valid.
CipherException - An error occurred during decryption.
InvalidInputException - The message content type is incorrect.
javax.mail.MessagingException - An error occurred while setting the decrypted content.
oracle.security.crypto.cms.UnknownRecipientException - The key pair does not belong to message recipient.

getContentEncryptionAlgID

public 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(oracle.security.crypto.cert.X509 cert)
                  throws AlgorithmIdentifierException,
                         CipherException,
                         InvalidKeyException
Add a Recipient.
Parameters:
cert - The X509 public key certificate.
Throws:
AlgorithmIdentifierException - The encryption algorithm is not supported.
CipherException - An error occurred during encryption.
InvalidKeyException - The public key is not valid.

addRecipient

public void addRecipient(oracle.security.crypto.cert.X509 cert,
                         AlgorithmIdentifier keyEncryptionAlgID)
                  throws AlgorithmIdentifierException,
                         CipherException,
                         InvalidKeyException
Add a Recipient.
Parameters:
cert - The X509 public key certificate.
keyEncryptionAlgID - The key transport algorithm.
Throws:
AlgorithmIdentifierException - The encryption algorithm is not supported.
CipherException - An error occurred during encryption.
InvalidKeyException - The public key is not valid.

writeTo

public void writeTo(java.io.OutputStream os,
                    java.lang.String mimeType)
             throws java.io.IOException,
                    javax.mail.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.
javax.mail.MessagingException - An error occurred while creating the smime message.

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.