OLD | NEW |
1 | 1 |
2 The public/private key pairs were generated with the following commands: | 2 The public/private key pairs were generated with the following commands: |
3 | 3 |
4 openssl genrsa -out private_key.pem 2048 | 4 openssl genrsa -out private_key.pem 2048 |
5 openssl rsa -in private_key.pem -pubout -out public_key.pem | 5 openssl rsa -in private_key.pem -pubout -out public_key.pem |
6 | 6 |
7 | 7 |
| 8 The payload.json file contains randomly generated base64url encoded sha256 |
| 9 hashes for a set of file paths. |
| 10 |
| 11 |
8 The signature was generated by: | 12 The signature was generated by: |
9 | 13 |
10 1) Take the contents of payload.json and base64url encode them: | 14 1) Take the contents of payload.json and base64url encode them: |
11 cat payload.json | tr -d \\n | base64 -w0 | tr / _ | tr + \- | tr -d '=' > paylo
ad_encoded.txt | 15 cat payload.json | tr -d \\n | base64 -w0 | tr / _ | tr + \- | tr -d '=' > paylo
ad_encoded.txt |
12 | 16 |
13 2) Put the contents of payload_encoded.txt into the "payload" field of | 17 2) Put the contents of payload_encoded.txt into the "payload" field of |
14 verified_contents.json. | 18 verified_contents.json. |
15 | 19 |
16 3) Copy the contents of the "protected" field from verified_contents.json into | 20 3) Copy the contents of the "protected" field (the one with {"kid": |
17 protected.txt. | 21 "webstore"}) from verified_contents.json into protected.txt. |
18 | 22 |
19 4) Concatenate the "protected" and "payload" fields with a '.' separator. | 23 4) Concatenate the "protected" and "payload" fields with a '.' separator. |
20 | 24 |
21 echo -n '.' | cat protected.txt - payload_encoded.txt > signature_input.txt | 25 echo -n '.' | cat protected.txt - payload_encoded.txt > signature_input.txt |
22 | 26 |
23 5) Sign it | 27 5) Sign it |
24 | 28 |
25 tr -d \\n < signature_input.txt | openssl dgst -sha256 -sign private_key.pem -bi
nary | base64 -w0 | tr / _ | tr + \- | tr -d '=' > signature.txt | 29 tr -d \\n < signature_input.txt | openssl dgst -sha256 -sign private_key.pem -bi
nary | base64 -w0 | tr / _ | tr + \- | tr -d '=' > signature.txt |
26 | 30 |
27 6) Put the contents of signature.txt into the "signature" field in | 31 6) Put the contents of signature.txt into the "signature" field in |
28 verified_contents.json. | 32 verified_contents.json. |
OLD | NEW |