Encryption loop bug
Status: Beta
Brought to you by:
akp
From EncryptionManager.java
This will never work!!!
public MimeMessage encryptMessage(MimeMessage mMsg)
throws MessagingException,
java.security.GeneralSecurityException,
java.io.IOException {
// if we don't have a key, see if we can get a default.
Key key = null;
Address[] recipients =
mMsg.getRecipients(Message.RecipientType.TO);
for (int i = 0; key == null && i <
recipients.length; i++) {
if (recipients[i] instanceof InternetAddress) {
String inetAddr = ((InternetAddress)
recipients[i]).getAddress();
Key[] matchingKeys = getPublicKeys(inetAddr);
if (matchingKeys != null) {
for (int j = 0; key != null && j <
matchingKeys.length; j++) {
key = matchingKeys[j];
}
}
}
}
return encryptMessage(mMsg, key);
}