Attach autocrypt public key

This commit is contained in:
M66B
2019-12-22 09:30:02 +01:00
parent 429c5002b1
commit a51c8bd6db
2 changed files with 44 additions and 1 deletions

View File

@@ -236,9 +236,11 @@ public class MessageHelper {
StringBuilder sb = new StringBuilder();
try (BufferedReader br = new BufferedReader(new FileReader(file))) {
String line;
while ((line = br.readLine()) != null)
while ((line = br.readLine()) != null) {
Log.i(line);
if (!line.startsWith("-----") && !line.endsWith("-----"))
sb.append(line);
}
}
imessage.addHeader("Autocrypt",
@@ -876,6 +878,20 @@ public class MessageHelper {
}
}
String getAutocrypt() throws MessagingException {
String autocrypt = imessage.getHeader("Autocrypt", null);
if (autocrypt == null)
return null;
autocrypt = MimeUtility.unfold(autocrypt);
int k = autocrypt.indexOf("keydata=");
if (k < 0)
return null;
return autocrypt.substring(k + 8);
}
String getSubject() throws MessagingException {
String subject = imessage.getHeader("Subject", null);
if (subject == null)