1 | static bool isSignedWithKey_verbose; |
2 | |
3 | static boolean isSignedWithKey(S signed, S key) { |
4 | try { |
5 | L<S> lines = toLines(signed); |
6 | if (swic(last(lines), "signer:")) popLast(lines); |
7 | S sigLine = last(lines); |
8 | S text = fromLines(dropLast(lines)); |
9 | S sig = dropPrefixMandatory("sig: ", sigLine); |
10 | ret PKI.verifySignature(PKI.publicKeyFromString(key), PKI.signatureFromString(sig), toUtf8(text)); |
11 | } catch (RuntimeException e) { |
12 | if (isSignedWithKey_verbose) |
13 | printStackTrace(e); |
14 | ret false; |
15 | } |
16 | } |
Began life as a copy of #1001567
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1001583 |
Snippet name: | isSignedWithKey |
Eternal ID of this version: | #1001583/4 |
Text MD5: | ae3d5e8da832f8129640829b4a7a7a1a |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-09-30 16:01:58 |
Source code size: | 537 bytes / 16 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 692 / 912 |
Version history: | 3 change(s) |
Referenced in: | [show references] |