diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-09-03 13:05:22 +0200 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-09-03 13:05:22 +0200 |
commit | 5ae62f18b4202dcb49b19964ade46e203eefc917 (patch) | |
tree | d2077444913b962392a2dd743c854b0550e047a0 /src/eu/siacs/conversations/crypto/PgpEngine.java | |
parent | 1a09a4706b7cc53225abd5c6124f3da2f784ad61 (diff) |
fixed pgp signature creation
Diffstat (limited to '')
-rw-r--r-- | src/eu/siacs/conversations/crypto/PgpEngine.java | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/eu/siacs/conversations/crypto/PgpEngine.java b/src/eu/siacs/conversations/crypto/PgpEngine.java index 430aaf99..71282c44 100644 --- a/src/eu/siacs/conversations/crypto/PgpEngine.java +++ b/src/eu/siacs/conversations/crypto/PgpEngine.java @@ -295,9 +295,25 @@ public class PgpEngine { switch (result.getIntExtra(OpenPgpApi.RESULT_CODE, 0)) { case OpenPgpApi.RESULT_CODE_SUCCESS: StringBuilder signatureBuilder = new StringBuilder(); - String[] lines = os.toString().split("\n"); - for (int i = 7; i < lines.length - 1; ++i) { - signatureBuilder.append(lines[i].trim()); + try { + os.flush(); + 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()); callback.success(account); |