|
Enhydra-Oyster 2.1-7 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.enhydra.oyster.smime.BaseSMIMEObject
org.enhydra.oyster.smime.BaseSignedSMIMEObject
This class is used as super class for SignedSMIME and SignedAndEnvelopedSMIME classes. It contains the common methods for this two classes.
Field Summary | |
protected java.util.Vector |
aditionalCerts
Storage for additional certificates |
protected java.util.Vector |
capabilities
Storage for capabilities (used for first type of addSigner function) |
protected java.util.Vector |
capabilities2
Storage for capabilities (used for second type of addSigner function) |
protected java.util.Vector |
capabilitiesTemp
Temporary storage for capabilities (after method addSigner, this object is copied to capabilities or capabilities2). |
protected java.util.Vector |
certChainArray
Storage for certificate chain corresponding to appropriate signing session (used for second type of addSigner function) |
protected java.util.Vector |
digestArray
Storage for digest algorithm corresponding to appropriate signing session (used for first type of addSigner function). |
protected java.util.Vector |
digestArray2
Storage for digest algorithm corresponding to appropriate signing session (used for second type of addSigner function) |
protected java.util.Vector |
including
Storage for byte[2] grouped indicators (used for first type of addSigner function). |
protected java.util.Vector |
including2
Storage for byte[2] grouped indicators (used for second type of addSigner function) |
protected java.util.Vector |
ksArray
Storage for .pfx files corresponding to appropriate signing session (used for first type of addSigner function). |
protected java.util.Vector |
privKeyArray
Storage for private key corresponding to appropriate signing session (used for second type of addSigner function) |
Fields inherited from class org.enhydra.oyster.smime.BaseSMIMEObject |
bodyPartArray, certArray, charsetEnc, contentPresence, externalMessagePresence, indicatorTo, message |
Fields inherited from interface org.enhydra.oyster.crypto.consts.SignedConstants |
MD2_WITH_RSA, MD5_WITH_RSA, SHA1_WITH_DSA, SHA1_WITH_RSA |
Fields inherited from interface org.enhydra.oyster.crypto.consts.KeyStoreConstants |
BKS, JKS, PKCS12, UBER |
Constructor Summary | |
protected |
BaseSignedSMIMEObject()
Simple constructor. |
protected |
BaseSignedSMIMEObject(javax.mail.internet.MimeMessage mimeMessage)
Construction of message with external prepared MimeMessage object. |
protected |
BaseSignedSMIMEObject(java.lang.String smtpHost,
java.lang.String fromAddress,
java.lang.String subject,
java.lang.String charset)
Initializes the JavaMail session for SMTP and the MimeMessage object for message which will be sent. |
protected |
BaseSignedSMIMEObject(java.lang.String smtpHost,
java.lang.String fromAddress,
java.lang.String subject,
java.lang.String content,
java.lang.String charset)
Initializes the JavaMail session for SMTP and the MimeMessage object for message which will be sent. |
Method Summary | |
void |
addCertificate(java.security.cert.X509Certificate cert)
Adds additional certificate to signed message. |
void |
addSigner(java.security.KeyStore kStore,
java.lang.String password,
java.lang.String alias,
java.lang.String signingAlg,
boolean includingCert,
boolean includingSignAttrib)
Adds signer to signed and enveloped S/MIME message. |
void |
addSigner(java.lang.String pfxfileName,
java.lang.String password,
java.lang.String signingAlg,
boolean includingCert,
boolean includingSignAttrib)
Adds signer to signed and enveloped S/MIME message. |
void |
addSigner(java.lang.String ksPath,
java.lang.String ksType,
java.lang.String password,
java.lang.String alias,
java.lang.String signingAlg,
boolean includingCert,
boolean includingSignAttrib)
Adds signer to signed and enveloped S/MIME message. |
void |
addSigner(java.security.cert.X509Certificate[] chain,
java.security.PrivateKey privKey,
java.lang.String signingAlg,
boolean includingCert,
boolean includingSignAttrib)
Adds signer to signed and enveloped S/MIME message. |
void |
reset()
Resets all attributes in BaseSignedSMIMEObject to their initial values. |
void |
setCapabilities(java.lang.String type0,
java.lang.String[] capability0)
Sets Capabilities Attributes (method is optional, but if exists, must be performed before addSigner method). |
Methods inherited from class org.enhydra.oyster.smime.BaseSMIMEObject |
addAttachment, addAttachment, addAttachment, addAttachment, addAttachment, addAttachment, addRecipient, addRecipient, addRecipient, getMimeMessage, initMimeMessage, send, setCharsetEncoding, setContent, setContent, setContent, setContent, setContent, setContent, setContent, setContent, setContent, setContent, setReply |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.util.Vector ksArray
protected java.util.Vector digestArray
protected java.util.Vector including
protected java.util.Vector certChainArray
protected java.util.Vector privKeyArray
protected java.util.Vector digestArray2
protected java.util.Vector including2
protected java.util.Vector aditionalCerts
protected java.util.Vector capabilitiesTemp
protected java.util.Vector capabilities
protected java.util.Vector capabilities2
Constructor Detail |
protected BaseSignedSMIMEObject()
protected BaseSignedSMIMEObject(java.lang.String smtpHost, java.lang.String fromAddress, java.lang.String subject, java.lang.String content, java.lang.String charset) throws SMIMEException
smtpHost
- name of SMTP host used for sending emailfromAddress
- email address of sender (FROM field in email header)subject
- subject of email (SUBJECT field in email header). This
argument can be null, but email message will be sent withouth SUBJECT.content
- text/plain content of email message. This argument can be
null, but later one of setContent() methods or one of addAttachment()
methods should be calledcharset
- character set for passed subject and content. The given
Unicode string will be charset-encoded using the specified charset. The
charset is also used to set the "charset" parameter. For example German
letters should be encoded by usage of 'ISO-8859-1' charset. If charset
parameter is null and subject or content contains non US-ASCII characters,
it will be encoded using the platform's default charset.
SMIMEException
- if smtpHost or fromAddress parameters are null.
Also, it can be caused by non SMIMEException which is MessagingException.protected BaseSignedSMIMEObject(java.lang.String smtpHost, java.lang.String fromAddress, java.lang.String subject, java.lang.String charset) throws SMIMEException
smtpHost
- name of SMTP host used for sending emailfromAddress
- email address of sender (FROM field in email header)subject
- subject of email (SUBJECT field in email header). This
argument can be null, but email message will be sent withouth SUBJECT.charset
- character set for passed subject and content. The given
Unicode string will be charset-encoded using the specified charset. The
charset is also used to set the "charset" parameter. For example German
letters should be encoded by usage of 'ISO-8859-1' charset. If charset
parameter is null and subject or content contains non US-ASCII characters,
it will be encoded using the platform's default charset.
SMIMEException
- if smtpHost or fromAddress parameters are null.
Also, it can be caused by non SMIMEException which is MessagingException.protected BaseSignedSMIMEObject(javax.mail.internet.MimeMessage mimeMessage) throws SMIMEException
mimeMessage
- external created MimeMessage object
SMIMEException
- if smtpHost or fromAddress parameter is null.
Also, it can be caused by non SMIMEException which is MessagingException.Method Detail |
public void setCapabilities(java.lang.String type0, java.lang.String[] capability0) throws SMIMEException
type0
- sets group of algorithms for capabilities attributes. It can be set
with values: SIGNATURE, SYMMETRIC, ENCIPHER or DEFAULT.capability0
- array of user prefered algorithms in user prrefered
order for each capabilityes group.
SMIMEException
- if same group is added more than once, invalid
group type is used, or group is added after DEFAULT option.public void addSigner(java.lang.String pfxfileName, java.lang.String password, java.lang.String signingAlg, boolean includingCert, boolean includingSignAttrib) throws SMIMEException
pfxfileName
- path and file name with certificate and private key
corresponding to the sender of the message (file with .p12 or .pfx extension)password
- used to access to .pfx or .p12 filesigningAlg
- algorithm used for signing (can be SHA1_WITH_RSA,
MD2_WITH_RSA, MD5_WITH_RSA or SHA1_WITH_DSA).includingCert
- including/not including certificates to signed
messageincludingSignAttrib
- including/not including signed attributes
to signed message. Must be set to true in case of implicit signing
SMIMEException
- caused by non SMIMEException which can be one of the
following: FileNotFoundException, NoSuchProviderException, KeyStoreException
CertificateException, NoSuchAlgorithmException or IOException.public void addSigner(java.security.cert.X509Certificate[] chain, java.security.PrivateKey privKey, java.lang.String signingAlg, boolean includingCert, boolean includingSignAttrib)
chain
- certificate chain. First certificate in array must be
owner's certificate, and last certificate has to be root certificateprivKey
- private key corresponding to owner's certificate (DSA
or RSA depend on type of signing)signingAlg
- algorithm used for signing (can be SHA1_WITH_RSA,
MD2_WITH_RSA, MD5_WITH_RSA or SHA1_WITH_DSA).includingCert
- including/not including certificates to signed
messageincludingSignAttrib
- including/not including signed attributes
to signed message. Must be set to true in case of implicit signing.public void addSigner(java.security.KeyStore kStore, java.lang.String password, java.lang.String alias, java.lang.String signingAlg, boolean includingCert, boolean includingSignAttrib) throws SMIMEException
kStore
- instance of KeyStore class which represents an in-memory
collection of keys and certificates.password
- password used to access the corresponding private key,
stored in given KeyStore object.alias
- alias name which corresponds to desired private key. If alias
is given as null, then reading results are unpredictable.signingAlg
- algorithm used for signing (can be SHA1_WITH_RSA,
MD2_WITH_RSA, MD5_WITH_RSA or SHA1_WITH_DSA).includingCert
- including/not including certificates to signed
messageincludingSignAttrib
- including/not including signed attributes
to signed message. Must be set to true in case of implicit signing.
SMIMEException
- caused by non SMIMEException which can be one
of the following: KeyStoreException, UnrecoverableKeyException or
NoSuchAlgorithmException.public void addSigner(java.lang.String ksPath, java.lang.String ksType, java.lang.String password, java.lang.String alias, java.lang.String signingAlg, boolean includingCert, boolean includingSignAttrib) throws SMIMEException
ksPath
- is path to the file representation of KeyStore which holds
collection of keys and certificates. This file can be PKCS12 type (file
with .p12 or .pfx extension) or can be key store of other types readable
by 'BouncyCastle' or 'Sun' KeyStore implementation.ksType
- is type of KeyStore. It can be one of the following types:
JKS for 'Sun' KeyStore, 'BKS', 'PKCS12' or 'UBER') for 'BouncyCastle'
KeyStore. If ksType is given as null it will be assumed that PKCS12 type is
in use, and alias parameter will be ignored, so this method becomes
equivalent to addSigner() method which deal only with .pfx or .p12 files.password
- password used to access the corresponding private key,
stored in given KeyStore file.alias
- alias name which corresponds to desired private key. If alias
is given as null, then reading results are unpredictable.signingAlg
- algorithm used for signing (can be SHA1_WITH_RSA,
MD2_WITH_RSA, MD5_WITH_RSA or SHA1_WITH_DSA).includingCert
- including/not including certificates to signed
messageincludingSignAttrib
- including/not including signed attributes
to signed message. Must be set to true in case of implicit signing.
SMIMEException
- if wrong path to KeyStore file ia given. Also,
it can be caused by non SMIMEException which can be one of the following:
FileNotFoundException, KeyStoreException, IOException, CertificateException
or NoSuchAlgorithmException.public void addCertificate(java.security.cert.X509Certificate cert)
cert
- X509 certificatepublic void reset()
reset
in class BaseSMIMEObject
|
Enhydra-Oyster 2.1-7 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |