Methods Summary |
---|
protected java.lang.String[] | getAllowedInitParameters()
String[] allowedArray = {
"debug",
"keyStoreFileName",
"keyStorePassword",
"keyStoreType",
"keyAlias",
"keyAliasPassword",
"signerName",
"postmasterSigns",
"rebuildFrom",
"explanationText"
};
return allowedArray;
|
public java.lang.String | getExplanationText()If the <explanationText> init parameter is missing
returns the following default explanation template string:
The message this file is attached to has been signed on the server by
"[signerName]" <[signerAddress]>
to certify that the sender is known and truly has the following address (reverse-path):
[reversePath]
and that the original message has the following message headers:
[headers]
The signature envelopes this attachment too.
Please check the signature integrity.
"[signerName]" <[signerAddress]>
String explanationText = super.getExplanationText();
if (explanationText == null) {
explanationText = "The message this file is attached to has been signed on the server by\r\n"
+ "\t\"[signerName]\" <[signerAddress]>"
+ "\r\nto certify that the sender is known and truly has the following address (reverse-path):\r\n"
+ "\t[reversePath]"
+ "\r\nand that the original message has the following message headers:\r\n"
+ "\r\n[headers]"
+ "\r\n\r\nThe signature envelopes this attachment too."
+ "\r\nPlease check the signature integrity."
+ "\r\n\r\n"
+ "\t\"[signerName]\" <[signerAddress]>";
}
return explanationText;
|
public java.lang.String | getMailetInfo()Return a string describing this mailet.
return "SMIME Signature Mailet";
|
protected javax.mail.internet.MimeBodyPart | getWrapperBodyPart(org.apache.mailet.Mail mail)A text file with the massaged contents of {@link #getExplanationText}
is attached to the original message.
String explanationText = getExplanationText();
// if there is no explanation text there should be no wrapping
if (explanationText == null) {
return null;
}
MimeMessage originalMessage = mail.getMessage();
MimeBodyPart messagePart = new MimeBodyPart();
MimeBodyPart signatureReason = new MimeBodyPart();
String contentType = originalMessage.getContentType();
Object content = originalMessage.getContent();
if (contentType != null && content != null) {
messagePart.setContent(content, contentType);
} else {
throw new MessagingException("Either the content type or the content is null");
}
String headers = getMessageHeaders(originalMessage);
signatureReason.setText(getReplacedExplanationText(getExplanationText(),
getSignerName(),
getKeyHolder().getSignerAddress(),
mail.getSender().toString(),
headers));
signatureReason.setFileName("SignatureExplanation.txt");
MimeMultipart wrapperMultiPart = new MimeMultipart();
wrapperMultiPart.addBodyPart(messagePart);
wrapperMultiPart.addBodyPart(signatureReason);
MimeBodyPart wrapperBodyPart = new MimeBodyPart();
wrapperBodyPart.setContent(wrapperMultiPart);
return wrapperBodyPart;
|
protected void | initPostmasterSigns()If the <postmasterSigns> init parameter is missing sets it to true.
setPostmasterSigns((getInitParameter("postmasterSigns") == null) ? true : new Boolean(getInitParameter("postmasterSigns")).booleanValue());
|
protected void | initRebuildFrom()If the <rebuildFrom> init parameter is missing sets it to true.
setRebuildFrom((getInitParameter("rebuildFrom") == null) ? true : new Boolean(getInitParameter("rebuildFrom")).booleanValue());
if (isDebug()) {
if (isRebuildFrom()) {
log("Will modify the \"From:\" header.");
} else {
log("Will leave the \"From:\" header unchanged.");
}
}
|