aboutsummaryrefslogtreecommitdiffstats
path: root/Graphics/drawables
Commit message (Expand)AuthorAgeFilesLines
* Advanced screen, warning fragmentDominik Schürmann2016-01-1162-0/+13
* Use tor icon for settings screenDominik Schürmann2016-01-1162-0/+13
* Support for Android 6 ACTION_PROCESS_TEXTDominik Schürmann2015-11-023-5/+66
* linked: use link icon from octo set? not sure yet..Vincent Breitmoser2015-09-011-0/+3
* linked: update icon design of github l-id creationVincent Breitmoser2015-09-012-0/+2
* Merge branch 'linked-identities' (and fix OperationHelper ids)Vincent Breitmoser2015-08-295-0/+93
|\
| * Merge tag 'v3.2.1' into linked-identitiesVincent Breitmoser2015-05-112-586/+94
| |\
| * \ Merge branch 'development' into linked-identitiesVincent Breitmoser2015-04-244-213/+166
| |\ \
| * | | more linked id ui fine tuningVincent Breitmoser2015-03-264-958/+8
| * | | some linked id ui fine tuningVincent Breitmoser2015-03-264-0/+966
| * | | work on certification uiVincent Breitmoser2015-03-151-0/+77
* | | | New notify iconDominik Schürmann2015-06-241-24/+38
* | | | New all-white status bar icon to fix issue #1356moparisthebest2015-06-221-0/+51
| |_|/ |/| |
* | | Add screenshotsDominik Schürmann2015-05-061-2/+2
* | | Update function graphicDominik Schürmann2015-05-062-584/+92
| |/ |/|
* | Graphic stuffDominik Schürmann2015-04-173-213/+134
* | split up wait/action yubikey fragmentsVincent Breitmoser2015-03-211-0/+32
|/
* Improve iconsDominik Schürmann2015-03-093-26/+26
* Tryout design for encrypt, decryptDominik Schürmann2015-03-0670-0/+193
* Partially fix file namesDominik Schürmann2015-03-0463-0/+13
* Invoke NFC buttonDominik Schürmann2015-02-2564-61/+13
* First work on new key view toolbarDominik Schürmann2015-02-255-826/+195
* Once again: Colors and header imageDominik Schürmann2015-02-2297-1350/+7801
* Floating action button icons and methods for key listDominik Schürmann2015-02-2163-0/+1649
* Improve nav drawer drawableDominik Schürmann2015-02-031-137/+137
* Improve nav drawer drawableDominik Schürmann2015-02-031-2/+2
* Fix first time wizard designDominik Schürmann2015-02-033-55/+55
* Floating Action Button added in app settingsDominik Schürmann2015-02-031-643/+247
* Header exportedDominik Schürmann2015-01-301-1/+4
* Header image tryoutDominik Schürmann2015-01-291-0/+2029
* Cloud search iconDominik Schürmann2015-01-283-0/+56
* Reorganize folders of graphics sourcesDominik Schürmann2015-01-14131-0/+25654
class="kn">import org.spongycastle.openpgp.PGPUtil; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.operations.results.DecryptVerifyResult; import org.sufficientlysecure.keychain.operations.results.KeybaseVerificationResult; import org.sufficientlysecure.keychain.operations.results.OperationResult; import org.sufficientlysecure.keychain.pgp.PgpDecryptVerify; import org.sufficientlysecure.keychain.pgp.PgpDecryptVerifyInputParcel; import org.sufficientlysecure.keychain.pgp.Progressable; import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.service.KeybaseVerificationParcel; import org.sufficientlysecure.keychain.service.input.CryptoInputParcel; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.util.ArrayList; import java.util.List; public class KeybaseVerificationOperation extends BaseOperation<KeybaseVerificationParcel> { public KeybaseVerificationOperation(Context context, ProviderHelper providerHelper, Progressable progressable) { super(context, providerHelper, progressable); } @Override public KeybaseVerificationResult execute(KeybaseVerificationParcel keybaseInput, CryptoInputParcel cryptoInput) { String requiredFingerprint = keybaseInput.mRequiredFingerprint; OperationResult.OperationLog log = new OperationResult.OperationLog(); log.add(OperationResult.LogType.MSG_KEYBASE_VERIFICATION, 0, requiredFingerprint); try { String keybaseProof = keybaseInput.mKeybaseProof; Proof proof = new Proof(new JSONObject(keybaseProof)); mProgressable.setProgress(R.string.keybase_message_fetching_data, 0, 100); Prover prover = Prover.findProverFor(proof); if (prover == null) { log.add(OperationResult.LogType.MSG_KEYBASE_ERROR_NO_PROVER, 1, proof.getPrettyName()); return new KeybaseVerificationResult(OperationResult.RESULT_ERROR, log); } if (!prover.fetchProofData()) { log.add(OperationResult.LogType.MSG_KEYBASE_ERROR_FETCH_PROOF, 1); return new KeybaseVerificationResult(OperationResult.RESULT_ERROR, log); } if (!prover.checkFingerprint(requiredFingerprint)) { log.add(OperationResult.LogType.MSG_KEYBASE_ERROR_FINGERPRINT_MISMATCH, 1); return new KeybaseVerificationResult(OperationResult.RESULT_ERROR, log); } String domain = prover.dnsTxtCheckRequired(); if (domain != null) { DNSMessage dnsQuery = new Client().query(new Question(domain, Record.TYPE.TXT)); if (dnsQuery == null) { log.add(OperationResult.LogType.MSG_KEYBASE_ERROR_DNS_FAIL, 1); log.add(OperationResult.LogType.MSG_KEYBASE_ERROR_SPECIFIC, 2, getFlattenedProverLog(prover)); return new KeybaseVerificationResult(OperationResult.RESULT_ERROR, log); } Record[] records = dnsQuery.getAnswers(); List<List<byte[]>> extents = new ArrayList<List<byte[]>>(); for (Record r : records) { Data d = r.getPayload(); if (d instanceof TXT) { extents.add(((TXT) d).getExtents()); } } if (!prover.checkDnsTxt(extents)) { log.add(OperationResult.LogType.MSG_KEYBASE_ERROR_SPECIFIC, 1, getFlattenedProverLog(prover)); return new KeybaseVerificationResult(OperationResult.RESULT_ERROR, log); } } byte[] messageBytes = prover.getPgpMessage().getBytes(); if (prover.rawMessageCheckRequired()) { InputStream messageByteStream = PGPUtil.getDecoderStream(new ByteArrayInputStream (messageBytes)); if (!prover.checkRawMessageBytes(messageByteStream)) { log.add(OperationResult.LogType.MSG_KEYBASE_ERROR_SPECIFIC, 1, getFlattenedProverLog(prover)); return new KeybaseVerificationResult(OperationResult.RESULT_ERROR, log); } } PgpDecryptVerify op = new PgpDecryptVerify(mContext, mProviderHelper, mProgressable); PgpDecryptVerifyInputParcel input = new PgpDecryptVerifyInputParcel(messageBytes) .setSignedLiteralData(true) .setRequiredSignerFingerprint(requiredFingerprint); DecryptVerifyResult decryptVerifyResult = op.execute(input, new CryptoInputParcel()); if (!decryptVerifyResult.success()) { log.add(decryptVerifyResult, 1); return new KeybaseVerificationResult(OperationResult.RESULT_ERROR, log); } if (!prover.validate(new String(decryptVerifyResult.getOutputBytes()))) { log.add(OperationResult.LogType.MSG_KEYBASE_ERROR_PAYLOAD_MISMATCH, 1); return new KeybaseVerificationResult(OperationResult.RESULT_ERROR, log); } return new KeybaseVerificationResult(OperationResult.RESULT_OK, log, prover); } catch (Exception e) { // just adds the passed parameter, in this case e.getMessage() log.add(OperationResult.LogType.MSG_KEYBASE_ERROR_SPECIFIC, 1, e.getMessage()); return new KeybaseVerificationResult(OperationResult.RESULT_ERROR, log); } } private String getFlattenedProverLog(Prover prover) { String log = ""; for (String line : prover.getLog()) { log += line + "\n"; } return log; } }