1 | sbool getAuthorOfSignedJava_debug; |
2 | |
3 | static S getAuthorOfSignedJava(S signed) {
|
4 | try {
|
5 | L<S> lines = toLines(signed); |
6 | S authorLine = lines.get(lines.size()-2); |
7 | S sigLine = lines.get(lines.size()-1); |
8 | S text = fromLines(lines.subList(0, lines.size()-1)); |
9 | S author = dropPrefixMandatory("// -", authorLine);
|
10 | if (!isComputerID(author)) fail("Not a computer ID: " + author);
|
11 | S publicKey = getPublicKeyOfComputer(author); |
12 | if (publicKey == null) |
13 | fail("Computer " + author + " has to publish a public key.");
|
14 | S sig = dropPrefixMandatory("// sig: ", sigLine);
|
15 | if (PKI.verifySignature(PKI.publicKeyFromString(publicKey), PKI.signatureFromString(sig), toUtf8(text))) |
16 | ret author; |
17 | else |
18 | ret null; |
19 | } catch (RuntimeException e) {
|
20 | ret null; |
21 | } |
22 | } |
Began life as a copy of #1001567
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1001858 |
| Snippet name: | getAuthorOfSignedJava |
| Eternal ID of this version: | #1001858/2 |
| Text MD5: | e684873e15f96c99f10790976f95b22e |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-01-03 18:18:39 |
| Source code size: | 819 bytes / 22 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 756 / 1030 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |