|
IAIK High-Level API version 1.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object iaik.hlapi.DecrypterVerifier iaik.hlapi.SMimeDecrypterVerifier
public class SMimeDecrypterVerifier
This is a combined class for decrypting and verifying S/MIME messages. It supports encrypted only, signed only and signed and encrypted S/MIME messages.
Constructor Summary | |
---|---|
SMimeDecrypterVerifier()
Create a new object for decryption and/or verification of S/MIME messages. |
Method Summary | |
---|---|
void |
dropDecryptionKeys()
Release all references to any previously set decryption keys. |
String |
getCharacterSet()
Get the character encoding (charset parameter) of the content. |
String |
getContentBoundary()
Get the boundary string if the content data is a multipart MIME content. |
String |
getContentType()
Get the media type and subtype of the content type for the signed MIME entity, e.g. text/plain. |
Map |
getHeaders()
Get a reference to the map that contains all headers of the most recently parsed e-mail message. |
String |
getSender()
Get the sender of this e-mail message from the header fields, which may be different to the signer of the message. |
Date |
getSigningTime()
Get the signing time of this signed e-mail message or null if the message was
unsigned or did not contain a signing time. |
String |
getSubject()
Get the subject line of this e-mail message. |
InputStream |
process(InputStream in)
Decrypt and/or verify the given data. |
void |
registerDecryptionKey(KeyAndCertificate decryptionKey)
Register a key to be a decryption key for the associated certificate. |
Methods inherited from class iaik.hlapi.DecrypterVerifier |
---|
process, verify |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SMimeDecrypterVerifier()
Method Detail |
---|
public void registerDecryptionKey(KeyAndCertificate decryptionKey) throws HlApiException
DecrypterVerifier
The certificate in the decryptionKey
may be null
.
In this case, the decryption method will try to use this key for
decrypting the data. However, it is recommended to provide the
certificate that belongs to the private key.
registerDecryptionKey
in class DecrypterVerifier
decryptionKey
- The decryption key and the certificate.
HlApiException
- If handling the certificate fails.public void dropDecryptionKeys()
DecrypterVerifier
dropDecryptionKeys
in class DecrypterVerifier
public InputStream process(InputStream in) throws IOException, NoKeyException, HlApiException
DecrypterVerifier
If the data is encrypted, a suitable decryption keys must have been registered
before using DecrypterVerifier.registerDecryptionKey(KeyAndCertificate)
.
process
in class DecrypterVerifier
in
- The stream that provides the encrypted and/or signed data.
IOException
- If reading from the given stream fails.
NoKeyException
- If there is no suitable key available for decryption.
HlApiException
- If decryption or verification fails.public Date getSigningTime() throws HlApiException
null
if the message was
unsigned or did not contain a signing time.
The signing time is the time inside the signature and may be different to the time the e-mail was sent, i.e. the time in the e-mail headers.
getSigningTime
in class DecrypterVerifier
null
if unavailable.
HlApiException
- If parsing the signing time out of the signature
structure fails.public String getSender()
DecrypterVerifier.verify(CertValidator)
,
and sending it to KeyAndCertificate.getEMailAddress(X509Certificate)
.
public String getSubject()
public Map getHeaders()
FROM
and not from
or From
.
The value is also always a string.
If a header spans multiple lines (folding), the value is unfolded with
normalized whitespace, i.e. multiple consecutive whitespace characters are reduced to a
single space (0x20).
If a header occurs more than once, the multiple values are concatenated with a
carriage-return and line-feed between (CRLF, 0xD + 0xA).
Do not modify this table to avoid undesired side effects.
public String getContentType()
getCharacterSet()
instead.
public String getCharacterSet()
public String getContentBoundary()
null
, if there was no boundary parameter in the
content type.
|
IAIK High-Level API version 1.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2007,
IAIK, Graz University of Technology Copyright © 2007, Stiftung SIC |