public abstract class SignedMailDemo extends PKCS11Demo
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
recipient_
The email address of the recipient.
|
protected java.lang.String |
sender_
The email address of the sender.
|
protected iaik.x509.X509Certificate[] |
signerCertificates_
The certificate chain of the signer.
|
protected java.security.PrivateKey |
signerKey_
The private key of the signer.
|
iaikPkcs11Provider_, iaikSoftwareProvider_, moduleName_, tokenKeyStore_, userPin_
Modifier | Constructor and Description |
---|---|
protected |
SignedMailDemo(java.lang.String moduleName,
char[] userPin)
Creates a SignedMailDemo object for the given module name.
|
Modifier and Type | Method and Description |
---|---|
protected jakarta.mail.internet.MimeMessage |
createSignedMessage(jakarta.mail.Session session,
jakarta.activation.DataHandler dataHandler,
boolean implicit)
Creates a signed message.
|
protected void |
getSignatureKey()
This method gets the key stores of all inserted (compatible) smart
cards and simply takes the first key-entry.
|
protected void |
start(boolean implicit)
Starts the demo.
|
getKeyStore, init
protected java.security.PrivateKey signerKey_
protected iaik.x509.X509Certificate[] signerCertificates_
protected java.lang.String sender_
protected java.lang.String recipient_
protected SignedMailDemo(java.lang.String moduleName, char[] userPin)
moduleName
- the name of the moduleuserPin
- the user-pin (password) for the TokenKeyStore
(may be null
to pou-up a dialog asking for the pin)protected void getSignatureKey() throws java.security.GeneralSecurityException, java.io.IOException
signerKey_
and signerCertificate_
.java.security.GeneralSecurityException
- If anything with the provider fails.java.io.IOException
- If loading the key store fails.protected jakarta.mail.internet.MimeMessage createSignedMessage(jakarta.mail.Session session, jakarta.activation.DataHandler dataHandler, boolean implicit) throws jakarta.mail.MessagingException
session
- the mail sessiondataHandler
- the content of the message to be signedimplicit
- whether to use implicit (application/pkcs7-mime) or explicit
(multipart/signed) signingjakarta.mail.MessagingException
- if an error occurs when creating the messageprotected void start(boolean implicit) throws java.lang.Exception
implicit
- whether to create an implicit (content included;
application/pkcs7-mime) or an explicit (content
not included; multipart/signed) signed messagejava.lang.Exception
- if an error occurs