Menu

#37 Encryption loop bug

bug
open
nobody
Engine (10)
5
2005-08-29
2005-08-29
Anonymous
No

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);
}

Discussion


Log in to post a comment.