Update spec to always use binary format before base64

This commit is contained in:
franzap 2024-07-15 17:28:50 -03:00
parent 67755c4ddd
commit 385ce170e8

36
39.md
View File

@ -75,17 +75,19 @@ This can be located at `https://t.me/<proof>`.
Identity: An OpenPGP fingerprint as described in the [openpgp4fpr URI scheme](https://metacode.biz/openpgp/openpgp4fpr), lowercased. Identity: An OpenPGP fingerprint as described in the [openpgp4fpr URI scheme](https://metacode.biz/openpgp/openpgp4fpr), lowercased.
Proof: A signature of the text `Verifying that I control the following Nostr public key: "<npub encoded public key>"` in base64 format, unwrapped. Proof: A binary signature of the text `Verifying that I control the following Nostr public key: "<npub encoded public key>"` converted to base64 format, unwrapped.
Public key material: The full OpenPGP public key (including `BEGIN`/`END` PEM markers) in base64 format, unwrapped. Public key material: The full, binary, non-ASCII, OpenPGP public key converted to base64 format, unwrapped.
#### Example #### Example
Using text `Verifying that I control the following Nostr public key: "npub1wf4pufsucer5va8g9p0rj5dnhvfeh6d8w0g6eayaep5dhps6rsgs43dgh9"`
```jsonc ```jsonc
{ {
"kind": 0, "kind": 0,
"tags": [ "tags": [
["i", "openpgp4fpr:1a04e0f1a78d982bd8885b7eb325a9c5f70849d0", "LS0tLS1CRUdJTiBQR1AgTUVTU0FHRS0tLS0tCgpvd0did012TXdDVzJXWFhsMGU4Y25oY1lUeTlJWWtpVGw0bHpxbFFvemt6UHk4eExWeWpKeUN4V3lFMHRMazVNClQxWHdWRWpPejB2TExNb0ZDaWVXUUxnbFJmazVRRzZxUWtGUlpsbGlTYXBDZG1xbFFscCtFVmpNTDcrNHBFaWgKb0RRcEp6TVpMSkVIWkJ1V3A1a1VsS1lWbHlhbkZwbVdKVnFrV3hZWUZHV1pwdVJsbEtXbFpwaWxXSlFicEp1bApKbFltcGhhWXBtUVVGSnNWRmFjWG14aW5wR2RZY25XVXNqQ0ljVEhJaWlteVNMRTgrTGk4ZDRiMmpZN29PcGdQCldKbEF6bWZnNGhTQWlTU0pNVExjL2E3YmRtZUx3S0dMZWs2NkRTcD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UZuDlvEAAA==", "mDMEZgHdOxYJKwYBBAHaRw8BAQdA6pZgdsmDviRF45Cc+9MBb+udQDYgfGF6kBBUMByGxKa0F2ZyYW56YXAgPF9AZnJhbnphcC5jb20+iJMEExYKADsWIQQaBODxp42YK9iIW36zJanF9whJ0AUCZgHdOwIbAwULCQgHAgIiAgYVCgkICwIEFgIDAQIeBwIXgAAKCRCzJanF9whJ0L9GAQCuEPQtioDtiJicUHl8KDjSGfEMehAVv6lLbnd0SF3z/AD+PebBpY7bL/jF8BubiO+VogmHlkcFgxyWfD060000oAo="],
// ... // ...
], ],
// ... // ...
@ -95,13 +97,13 @@ Public key material: The full OpenPGP public key (including `BEGIN`/`END` PEM ma
Example command to obtain a signature: Example command to obtain a signature:
```bash ```bash
echo 'Verifying that I control the following Nostr public key: "<npub encoded public key>"' | gpg --sign --armor | base64 echo -n 'Verifying that I control the following Nostr public key: "<npub encoded public key>"' | gpg --sign | base64
``` ```
Example command to export the public key: Example command to export the public key:
```bash ```bash
gpg --armor --export name@example.com | base64 gpg --export name@example.com | base64
``` ```
### `x509` ### `x509`
@ -110,15 +112,17 @@ Identity: The X.509 certificate's SHA-256 fingerprint, lowercased.
Proof: A signature of the text `Verifying that I control the following Nostr public key: "<npub encoded public key>"` in base64 format, unwrapped. Proof: A signature of the text `Verifying that I control the following Nostr public key: "<npub encoded public key>"` in base64 format, unwrapped.
Public key material: The full public key (including `BEGIN`/`END` PEM markers) of the certificate in base64 format, unwrapped. Public key material: The full, binary, DER-formatted public key of the certificate converted to base64 format, unwrapped.
#### Example #### Example
Using text `Verifying that I control the following Nostr public key: "npub1wf4pufsucer5va8g9p0rj5dnhvfeh6d8w0g6eayaep5dhps6rsgs43dgh9"`
```jsonc ```jsonc
{ {
"kind": 0, "kind": 0,
"tags": [ "tags": [
["i", "x509:3220c353a73cfbd0c2f3052471c445324cf452bcba26de1c473a52fe5c44e1d6", "DRhQobBXnYFijFjJFZNWiAstqDv+8OACMQIzh+KKw0XS1PW869alYS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YIKoZIzj0DAQcDQgAEH/reUjCQlypniNHFvJaW0eBAek57CEKhDOYBQp+f0GPOkooe0xLtHHmn/2cGoxvbXAjpvFkjJLXm2wcXMyB1fg=="],
// ... // ...
], ],
// ... // ...
@ -131,22 +135,24 @@ Example command to find the SHA-256 fingerprint of the certificate from a keysto
keytool -list -keystore example.keystore keytool -list -keystore example.keystore
``` ```
Example of removing non-hexadecimal characters and lowercasing from the previous output:
```bash
echo -n "99:E3:3B:0C:2D:07:E7:5F:CD:9D:F7:E4:0E:88:66:46:FF:66:7E:3A:A6:64:8E:1A:11:60:B0:36:CF:2B:93:20" | tr -d -c '0-9A-Fa-f' | tr '[:upper:]' '[:lower:]'
```
Example commands to extract the private key and sign the message: Example commands to extract the private key and sign the message:
```bash ```bash
keytool -importkeystore -srckeystore example.keystore -destkeystore example.p12 -deststoretype pkcs12 keytool -importkeystore -srckeystore example.keystore -destkeystore example.p12 -deststoretype pkcs12
openssl pkcs12 -in example.p12 -nocerts -nodes -out privatekey.pem openssl pkcs12 -in example.p12 -nocerts -noenc -out privatekey.pem
echo 'Verifying that I control the following Nostr public key: "<npub encoded public key>"' | openssl dgst -sha256 -sign privatekey.pem | openssl base64 -A echo -n 'Verifying that I control the following Nostr public key: "<npub encoded public key>"' | openssl dgst -sha256 -binary -sign privatekey.pem | openssl base64 -A
``` ```
Example commands to extract the public key: Example command to extract the public key:
```bash ```bash
openssl rsa -in privatekey.pem -pubout | base64 openssl rsa -in privatekey.pem -outform der -pubout | base64
// or
openssl ec -in privatekey.pem -pubout | base64
``` ```