cmd/age,tag: implement age1tag1.../p256tag recipients

See C2SP/C2SP#156
This commit is contained in:
Filippo Valsorda
2025-08-16 23:11:02 +01:00
committed by Filippo Valsorda
parent acab3e5c9f
commit e9295dd867
7 changed files with 680 additions and 0 deletions

View File

@@ -16,6 +16,7 @@ import (
"filippo.io/age/agessh"
"filippo.io/age/armor"
"filippo.io/age/plugin"
"filippo.io/age/tag"
"golang.org/x/crypto/cryptobyte"
"golang.org/x/crypto/ssh"
)
@@ -30,6 +31,8 @@ func (gitHubRecipientError) Error() string {
func parseRecipient(arg string) (age.Recipient, error) {
switch {
case strings.HasPrefix(arg, "age1tag1"):
return tag.ParseRecipient(arg)
case strings.HasPrefix(arg, "age1") && strings.Count(arg, "1") > 1:
return plugin.NewRecipient(arg, pluginTerminalUI)
case strings.HasPrefix(arg, "age1"):