Oracle Email Java API Reference
Release 2(9.0.4)

B10724-01

oracle.mail.sdk.esmail
Class OracleSMimeBodyPart

java.lang.Object
  |
  +--oracle.mail.sdk.esmail.OracleSMimeBodyPart

public class OracleSMimeBodyPart
extends java.lang.Object

This class supports SMime functionality for decrypting and verifying smime encrypted and signed message parts. A user's certificates and keys may be passed in as FileInputStreams or a file path. The certificates and keys are read in and the decrypted part is returned as a MimeBodyPart object. Internally, S/MIME V3 toolkit wrappers based on S/MIME v3 RFC 2630 and RFC 2634 ESS specifications are called.

Since:
release specific (what release of product did this appear in)
Version:
$Header: OracleSMimeBodyPart.java 20-jun-2002.11:18:10 vcao Exp $

Field Summary
static int DES_CBC
          Encryption Algorithm: DES_CBC
static int DES_EDE3_CBC
          Encryption Algorithm: DES_EDE3_CBC
static int DSA
          Signature Algorithm: DSA
static int MD5
          Digest Algorithm: MD5
static int RC2_CBC_128
          Encryption Algorithm: RC2_CBC_128
static int RC2_CBC_40
          Encryption Algorithm: RC2_CBC_40
static int RC2_CBC_64
          Encryption Algorithm: RC2_CBC_64
static int RSA
          Signature Algorithm: RSA
static int SHA1
          Digest Algorithm: SHA1

 

Constructor Summary
OracleSMimeBodyPart()
           

 

Method Summary
static oracle.mail.sdk.esmail.MimeBodyPart decode(java.io.FileInputStream userCert, java.io.FileInputStream userPrvKey, java.io.ByteArrayInputStream decodedStream)
           This method takes in the user certificate and the private keys as FileInputStream and the content of the message part to decode and returns a decrypted MimeBodyPart object.
static oracle.mail.sdk.esmail.MimeBodyPart decode(java.lang.String userCertFileName, java.lang.String userPrvKeyFileName, java.io.ByteArrayInputStream decodedStream)
           This method takes in the user certificate file location and the private key file location and the content of the message part to decode and returns a decrypted MimeBodyPart object.
static oracle.mail.sdk.esmail.MimeMessage encryptMessage(oracle.mail.sdk.esmail.MimeMessage message, oracle.mail.sdk.esmail.Session session, java.io.InputStream userCertificate, java.io.InputStream userPrivateKey, java.io.InputStream[] recipientCertificates, boolean includeOrigCerts, boolean includeOrigAsRecip, int encryptAlgorithm)
           Encrypt a mime message.
static void setDebugOff()
          Turn debugging off
static void setDebugOn()
          Turn debugging on.
static oracle.mail.sdk.esmail.MimeMessage signMessage(oracle.mail.sdk.esmail.MimeMessage message, oracle.mail.sdk.esmail.Session session, java.io.InputStream userCertificate, java.io.InputStream userPrivateKey, boolean includeOrigCerts, int digestAlgorithm, int signatureAlgorithm)
           Digitally sign a mime message.
static oracle.mail.sdk.esmail.MimeMessage signNencryptMessage(oracle.mail.sdk.esmail.MimeMessage message, oracle.mail.sdk.esmail.Session session, java.io.InputStream userCertificate, java.io.InputStream userPrivateKey, java.io.InputStream[] recipientCertificates, boolean includeOrigCerts, boolean includeOrigAsRecip, int encryptAlgorithm, int digestAlgorithm, int signatureAlgorithm)
           Digitally sign and encrypt a mime message.
static int verify_message(java.io.FileInputStream userCertificate, java.io.FileInputStream userPrivateKey, java.io.ByteArrayInputStream[] originalContent, java.io.InputStream[] signatureCertificates, java.io.InputStream signature)
           This method takes in the user certificate file and the private keys file, the content of the message part that contains the signature to verify, the sinature certificates and the actual signature and returns an integer value(1 - verified, 0 - not verified).
static int verify_message(java.lang.String userCertFileName, java.lang.String userPrvKeyFileName, java.io.ByteArrayInputStream[] originalContent, java.io.InputStream[] signatureCertificates, java.io.InputStream signature)
           This method takes in the user certificate filename and the private keys filename, the content of the message part that contains the signature to verify, the sinature certificates and the actual signature and returns an integer value(1 - verified, 0 - not verified).

 

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

 

Field Detail

SHA1

public static final int SHA1
Digest Algorithm: SHA1

MD5

public static final int MD5
Digest Algorithm: MD5

DES_EDE3_CBC

public static final int DES_EDE3_CBC
Encryption Algorithm: DES_EDE3_CBC

DES_CBC

public static final int DES_CBC
Encryption Algorithm: DES_CBC

RC2_CBC_128

public static final int RC2_CBC_128
Encryption Algorithm: RC2_CBC_128

RC2_CBC_64

public static final int RC2_CBC_64
Encryption Algorithm: RC2_CBC_64

RC2_CBC_40

public static final int RC2_CBC_40
Encryption Algorithm: RC2_CBC_40

RSA

public static final int RSA
Signature Algorithm: RSA

DSA

public static final int DSA
Signature Algorithm: DSA
Constructor Detail

OracleSMimeBodyPart

public OracleSMimeBodyPart()
Method Detail

setDebugOn

public static void setDebugOn()
Turn debugging on.

Debug information is written to System.Out


setDebugOff

public static void setDebugOff()
Turn debugging off

decode

public static oracle.mail.sdk.esmail.MimeBodyPart decode(java.lang.String userCertFileName,
                                                         java.lang.String userPrvKeyFileName,
                                                         java.io.ByteArrayInputStream decodedStream)

This method takes in the user certificate file location and the private key file location and the content of the message part to decode and returns a decrypted MimeBodyPart object.

Parameters:
userCertFileName - user certificate file location
userPrvKeyFileName - private key file location
decodedStream - body part as a ByteArrayInputStream
Returns:
MimeBodyPart

decode

public static oracle.mail.sdk.esmail.MimeBodyPart decode(java.io.FileInputStream userCert,
                                                         java.io.FileInputStream userPrvKey,
                                                         java.io.ByteArrayInputStream decodedStream)

This method takes in the user certificate and the private keys as FileInputStream and the content of the message part to decode and returns a decrypted MimeBodyPart object.

Parameters:
userCert - user certificate
userPrvKey - private key
decodedStream - body part as a ByteArrayInputStream
Returns:
MimeBodyPart

verify_message

public static int verify_message(java.lang.String userCertFileName,
                                 java.lang.String userPrvKeyFileName,
                                 java.io.ByteArrayInputStream[] originalContent,
                                 java.io.InputStream[] signatureCertificates,
                                 java.io.InputStream signature)
                          throws java.lang.Exception

This method takes in the user certificate filename and the private keys filename, the content of the message part that contains the signature to verify, the sinature certificates and the actual signature and returns an integer value(1 - verified, 0 - not verified).

Parameters:
userCertFileName - user certificate filename
userPrvKeyFileName - private key filename
originalContent - body part content
signatureCertificates - signature certificate
signature - signature
Returns:
int 0 - verfied successfully else failed

verify_message

public static int verify_message(java.io.FileInputStream userCertificate,
                                 java.io.FileInputStream userPrivateKey,
                                 java.io.ByteArrayInputStream[] originalContent,
                                 java.io.InputStream[] signatureCertificates,
                                 java.io.InputStream signature)
                          throws java.lang.Exception

This method takes in the user certificate file and the private keys file, the content of the message part that contains the signature to verify, the sinature certificates and the actual signature and returns an integer value(1 - verified, 0 - not verified).

Parameters:
userCertificate - user certificate file
userPrivateKey - private key file
originalContent - body part content
signatureCertificates - signature certificate
signature - signature
Returns:
int 0 - verified successfully else failed

encryptMessage

public static oracle.mail.sdk.esmail.MimeMessage encryptMessage(oracle.mail.sdk.esmail.MimeMessage message,
                                                                oracle.mail.sdk.esmail.Session session,
                                                                java.io.InputStream userCertificate,
                                                                java.io.InputStream userPrivateKey,
                                                                java.io.InputStream[] recipientCertificates,
                                                                boolean includeOrigCerts,
                                                                boolean includeOrigAsRecip,
                                                                int encryptAlgorithm)
                                                         throws oracle.mail.sdk.esmail.MessagingException,
                                                                java.io.IOException,
                                                                java.lang.Exception

Encrypt a mime message.

The user's certificate, private key, and the list of recipients' certificate is used to encrypt the passed in mime message and return a new encrypted MimeMessage object.

Parameters:
message - the mime message to be encrypted
session - the user's session; this is used for creating a new encrypted mime message
userCertificate - the user's certificate; containing the ASN.1 encoded X.509 user S/MIME certificate. All data should already be available.
userPrivateKey - the user's private key; containing the PKCS-8 encoded user private key. All data should already be available.
recipientCertificates - the recipients' certificates
includeOrigCerts - a flag to determine whether to include the originator's certifcate in the encrypted message.
includeOrigAsRecip - a flag to determine whether to include the originator as one of the recipients.
encryptAlgorithm - the alogorithm to use for encryption.
Returns:
a new encrypted mime message object
Throws:
oracle.mail.sdk.esmail.MessagingException - message exception IOException IO exception

signMessage

public static oracle.mail.sdk.esmail.MimeMessage signMessage(oracle.mail.sdk.esmail.MimeMessage message,
                                                             oracle.mail.sdk.esmail.Session session,
                                                             java.io.InputStream userCertificate,
                                                             java.io.InputStream userPrivateKey,
                                                             boolean includeOrigCerts,
                                                             int digestAlgorithm,
                                                             int signatureAlgorithm)
                                                      throws oracle.mail.sdk.esmail.MessagingException,
                                                             java.io.IOException,
                                                             java.lang.Exception

Digitally sign a mime message.

Parameters:
message - the mime message to be digitally signed
session - the user's session; this is used for creating a new digitally signed mime message
userCertificate - the user's certificate; containing the ASN.1 encoded X.509 user S/MIME certificate. All data should alread be availabe.
userPrivateKey - the user's private key; containing the PKCS-8 encoded user private key. All data should already be available.
recipientCertificates - the recipients' certificates
includeOrigCerts - a flag to determine whether to include the originator's certifcate in the signed message.
digestAlgorithm - the digest alogorithm to be used.
signatureAlgorithm - the alogorithm to use for digitally signing.
Returns:
a new digitally signed mime message object.
Throws:
oracle.mail.sdk.esmail.MessagingException - message exception IOException IO exception

signNencryptMessage

public static oracle.mail.sdk.esmail.MimeMessage signNencryptMessage(oracle.mail.sdk.esmail.MimeMessage message,
                                                                     oracle.mail.sdk.esmail.Session session,
                                                                     java.io.InputStream userCertificate,
                                                                     java.io.InputStream userPrivateKey,
                                                                     java.io.InputStream[] recipientCertificates,
                                                                     boolean includeOrigCerts,
                                                                     boolean includeOrigAsRecip,
                                                                     int encryptAlgorithm,
                                                                     int digestAlgorithm,
                                                                     int signatureAlgorithm)
                                                              throws oracle.mail.sdk.esmail.MessagingException,
                                                                     java.io.IOException,
                                                                     java.lang.Exception

Digitally sign and encrypt a mime message.

This method signs a mime message and then encrypt it. It returns a new mime message.

Parameters:
message - the mime message to be encrypted
session - the user's session; this is used for creating a new signed and encrypted mime message
userCertificate - the user's certificate; containing the ASN.1 encoded X.509 user S/MIME certificate. All data should already be available.
userPrivateKey - the user's private key; containing the PKCS-8 encoded user private key. All data should already be available.
recipientCertificates - the recipients' certificates
includeOrigCerts - a flag to determine whether to include the originator's certifcate in the encrypted message.
includeOrigAsRecip - a flag to determine whether to include the originator as one of the recipients.
encryptAlgorithm - the alogorithm to use for encryption.
digestAlgorithm - the digest alogorithm to be used.
signatureAlgorithm - the alogorithm to use for digitally signing.
Returns:
a new digitally signed and encrypted mime message object.
Throws:
oracle.mail.sdk.esmail.MessagingException - message exception IOException IO exception

Oracle Email Java API Reference
Release 2(9.0.4)

B10724-01

Copyright © 1988, 2003 Oracle Corporation. All Rights Reserved.