fixed pgp signature creation

This commit is contained in:
iNPUTmice 2014-09-03 13:05:22 +02:00
parent 1a09a4706b
commit 5ae62f18b4
1 changed files with 19 additions and 3 deletions

View File

@ -295,9 +295,25 @@ public class PgpEngine {
switch (result.getIntExtra(OpenPgpApi.RESULT_CODE, 0)) { switch (result.getIntExtra(OpenPgpApi.RESULT_CODE, 0)) {
case OpenPgpApi.RESULT_CODE_SUCCESS: case OpenPgpApi.RESULT_CODE_SUCCESS:
StringBuilder signatureBuilder = new StringBuilder(); StringBuilder signatureBuilder = new StringBuilder();
String[] lines = os.toString().split("\n"); try {
for (int i = 7; i < lines.length - 1; ++i) { os.flush();
signatureBuilder.append(lines[i].trim()); String[] lines = os.toString().split("\n");
boolean sig = false;
for(String line : lines) {
if (sig) {
if (line.contains("END PGP SIGNATURE")) {
sig = false;
} else {
signatureBuilder.append(line.trim());
}
}
if (line.contains("BEGIN PGP SIGNATURE")) {
sig = true;
}
}
} catch (IOException e) {
callback.error(R.string.openpgp_error, account);
return;
} }
account.setKey("pgp_signature", signatureBuilder.toString()); account.setKey("pgp_signature", signatureBuilder.toString());
callback.success(account); callback.success(account);