MessageInfo info = getMessageInfo();
if (info != null) {
MessageCryptoInfo cInfo = info.getCryptoInfo();
try {
if (cInfo != null && cInfo.isSigned()) {
CryptoStatusDisplay csd = null;
String fromString = "";
Address[] fromAddr = getMessageInfo().getMessage().getFrom();
if (fromAddr != null && fromAddr.length > 0) {
fromString = ((javax.mail.internet.InternetAddress)fromAddr[0]).getAddress();
}
java.security.Key[] keys = Pooka.getCryptoManager().getPublicKeys(
fromString, cInfo.getEncryptionType(), true);
if (keys == null || keys.length < 1) {
java.security.Key newKey = selectPublicKey(
Pooka.getProperty("Pooka.crypto.publicKey.forSig", "Select key for verifying the signature on this message."),
cInfo.getEncryptionType(),
forSignature);
keys = new java.security.Key[] { newKey };
}
if (keys != null) {
boolean checked = false;
for (int i = 0; (! checked) && i < keys.length; i++) {
checked = cInfo.checkSignature(keys[i], true);
if(checked)
break;
}
}
MessageUI ui = getMessageUI();
if (ui != null) {
csd = ui.getCryptoStatusDisplay();
}
if (csd != null)
csd.cryptoUpdated(cInfo);
ui.refreshDisplay();
}
} catch (Exception e) {
showError(Pooka.getProperty("Error.encryption.signatureValidationFailed", "Signature Validation Failed"), e);