Skip to content

age: Add specification for the p256tag recipient type & stanza.#96

Closed
remko wants to merge 1 commit intoC2SP:mainfrom
remko:age-p256tag
Closed

age: Add specification for the p256tag recipient type & stanza.#96
remko wants to merge 1 commit intoC2SP:mainfrom
remko:age-p256tag

Conversation

@remko
Copy link
Copy Markdown

@remko remko commented Aug 22, 2024

As discussed in #31

The current version of the spec is implemented in the HEAD of age-plugin-se behind a hidden --recipient-type=p256tag flag. If you have a mac with a secure enclave, you can create an identity for testing:

$ brew install --head age-plugin-se
$ age-plugin-se keygen --recipient-type=p256tag -o key.txt
Public key: age1p256tag1qdy22pj4javt8l0c37d28nsrcepf9te0xs07j8stacysyh6dq5pm5gdvwfv

# No support for this in age yet. 
# Symlink age-plugin-se to age-plugin-p256tag if you want to run this without age support.
$ echo 'hello, world' | age --encrypt -r age1p256tag1qdy22pj4javt8l0c37d28nsrcepf9te0xs07j8stacysyh6dq5pm5gdvwfv -o hello.age

$ age -i key.txt --decrypt hello.age 
hello, world

@remko remko force-pushed the age-p256tag branch 2 times, most recently from 4d98cc4 to 917beef Compare August 24, 2024 16:20
Comment on lines +290 to +292
The recipient is encoded as Bech32 with HRP `age1p256tag`.

age1p256tag1qf0l9gks6x65ha077wq3w3u8fy02tpg3cd9w5j0jlgpfgqkcut2lwpmkcwq
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The plugin protocol requires that this recipient be handled by the age-plugin-p256tag plugin and not by the native app, which I don't think is the intention. If we want to define a new recipient encoding that all age implementations are required to understand, it likely needs to be separate from the plugin namespace.

Comment on lines +280 to +285
Age does not generate p256tag identities, but supports encrypting to
p256tag recipients.

The p256tag recipient is computed as

recipient = P256(identity, basepoint)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth clarifying that the “identity” here refers to the private scalar in the abstract, with no encoding specified, and that the recipient's computation is (typically) not handled in software, if the intent is to hold a key inextricably in hw.

Comment on lines +287 to +288
P256 is the scalar multiplication over P-256, with SEC 1 point decoding and
encoding.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
P256 is the scalar multiplication over P-256, with SEC 1 point decoding and
encoding.
P256 is the scalar multiplication over P-256, with SEC 1 point encoding.

No curve point is being decoded in that computation; plus, “encoding” (as a noun) can encompass both operations. ^^

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also it might be a good idea to specify if point compression should be used or not.

type based on X25519, and a passphrase encryption type based on scrypt.
This document specifies three core age recipient types: an asymmetric encryption
type based on X25519, a passphrase encryption type based on scrypt, and a
tagged assymetric encryption type based on NIST P-256 for use with keys stored
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo, "assymetric" => "asymmetric"

@Foxboron
Copy link
Copy Markdown

I don't see Filippo tagged here for review, so friendly ping @FiloSottile

FiloSottile added a commit that referenced this pull request Aug 16, 2025
Based on a previous proposal by @remko, with the tag design suggested by
@erincandescent.

Closes #96
Closes #31
FiloSottile added a commit that referenced this pull request Aug 16, 2025
Based on a previous proposal by @remko, with the tag design suggested by
@erincandescent.

Closes #96
Closes #31

Co-authored-by: Jack Grigg <thestr4d@gmail.com>
FiloSottile added a commit that referenced this pull request Aug 17, 2025
Based on a previous proposal by @remko, with the tag design suggested by
@erincandescent.

Closes #96
Closes #31

Co-authored-by: Jack Grigg <thestr4d@gmail.com>
FiloSottile added a commit that referenced this pull request Nov 16, 2025
Based on a previous proposal by @remko, with the tag design suggested by
@erincandescent.

Closes #96
Closes #31

Co-authored-by: Jack Grigg <thestr4d@gmail.com>
FiloSottile added a commit that referenced this pull request Dec 7, 2025
Based on a previous proposal by @remko, with the tag design suggested by
@erincandescent.

Closes #96
Closes #31

Co-authored-by: Jack Grigg <thestr4d@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants