The oracle.security.crypto.smime.SmimeEnveloped Class The oracle.security.crypto.smime.SmimeMultipartSigned Class

6-6 Oracle Fusion Middleware Reference for Oracle Security Developer Tools Create a new SMIME Signed Message with a specified MIME body part and a flag switching compression on or off MimeBodyPart bp = new MimeBodyPart; bp.setTextHello from SendSignedMsg; boolean useCompression = true; SmimeSigned sig2 = new SmimeSignedbp, useCompression; To parse a message, use the constructor that takes a java.io.InputStream: InputStream is = Input stream containing message to be parsed SmimeSigned sig = new SmimeSignedis;

6.3.1.4 The oracle.security.crypto.smime.SmimeEnveloped Class

The oracle.security.crypto.smime.SmimeEnveloped class represents an SMIME enveloped message implements SmimeObject, and may be used to build a new message or parse an existing one. Constructors and methods include: SmimeEnveloped javax.mail.internet.MimeBodyPart content, oracle.security.crypto.core.AlgorithmIdentifier contentEncryptionAlgID Creates a new SmimeEnveloped object from the specified MIME body part, using the specified content encryption algorithm. SmimeEnveloped InputStream is Creates a new SmimeEnveloped object by reading its encoding from the specified input stream. void addRecipient java.security.cert.X509Certificate cert Encrypts the message for the recipient using the given public key certificate. byte[] getEncryptedContent Returns the contents without decrypting. javax.mail.internet.MimeBodyPart getEnclosedBodyPart java.security.PrivateKey recipientKey, java.security.cert.X509Certificate recipientCert Returns the MIME body part for the recipient specified by recipientCert, after decryption using the given recipient private key. Use the following code to build a new message: Create a new SMIME Enveloped Message with a specified MIME body part and a specified content encryption algorithm MimeBodyPart bp = new MimeBodyPart; bp.setTextHello from SendSignedMsg; AlgorithmIdentifier algId = AlgID.aes256_CBC; SmimeEnveloped env = new SmimeEnvelopedbp, algId; To parse a message, use the constructor that takes a java.io.InputStream: InputStream is = Input stream containing message to be parsed SmimeEnveloped env = new SmimeEnvelopedis;

6.3.1.5 The oracle.security.crypto.smime.SmimeMultipartSigned Class

The oracle.security.crypto.smime.SmimeMultipartSigned class represents an SMIME multi-part signed message. A multipart signed message is intended for email clients that are not MIME-aware. This class can be used to build a new message or parse an existing one. Constructors and methods include: Oracle SMIME 6-7 SmimeMultipartSigned javax.mail.internet.MimeBodyPart bodyPart, oracle.security.crypto.core.AlgorithmIdentifier digestAlgID Creates a new SmimeMultipartSigned message, with the specified MIME body part and message digest algorithm. void addBodyPart javax.mail.BodyPart part Inherited from javax.mail.Multipart, adds the specified body part to this SmimeMultipartSigned object. See the javax.mail API documentation at http:java.sun.comproductsjavamailjavadocsjavaxmailBodyPa rt.html for more details. void addSignature java.security.PrivateKey signerKey, java.security.cert.X509Certificate signerCert Adds a signature to the message, using the specified private key and certificate. void addSignature java.security.PrivateKey signerKey, java.security.cert.X509Certificate signerCert, java.util.Date timeStamp Adds a signature to the message, using the specified private key and certificate plus a time stamp. void addSignature java.security.PrivateKey signerKey, java.security.cert.X509Certificate signerCert, java.util.Date timeStamp, SmimeCapabilities smimeCaps Adds a signature to the message, using the specified private key and certificate, plus SMIME capabilities. javax.mail.internet.MimeBodyPart getEnclosedBodyPart Returns the MIME body part that was signed. Use the following code to build a new message: Create a new SMIME Multipart Signed Message with a specified MIME body part and a specified digest algorithm MimeBodyPart bp = new MimeBodyPart; bp.setTextHello from SendSignedMsg; AlgorithmIdentifier algId = AlgID.sha1; SmimeMutlipartSigned sig = new SmimeMultipartSignedbp, algId; To parse a message, use the constructor that takes a javax.activation.DataSource: DataSource ds = Data source containing message to be parsed SmimeMultipartSigned sig = new SmimeMultipartSignedds;

6.3.1.6 The oracle.security.crypto.smime.SmimeSignedReceipt Class