Debian Codegraph @

age/internal/tests/x25519_long_share.go

raw symbols SCIP
1 // Copyright 2022 The age Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 //go:build ignore
6 // +build ignore
7
8 package main
9
10 import (
11 "encoding/base64"
12
13 "c2sp.org/CCTV/age/internal/testkit"
14 "golang.org/x/crypto/curve25519"
15 )
16
17 func main() {
18 f := testkit.NewTestFile()
19 f.VersionLine("v1")
20 share, _ := curve25519.X25519(f.Rand(32), curve25519.Basepoint)
21 f.X25519RecordIdentity(testkit.TestX25519Identity)
22 f.X25519Stanza(share, testkit.TestX25519Identity)
23 body, _ := f.UnreadLine(), f.UnreadLine()
24 f.TextLine("-> X25519 " + base64.RawStdEncoding.EncodeToString(append(share, 0x00)))
25 f.TextLine(body)
26 f.HMAC()
27 f.Payload("age")
28 f.ExpectHeaderFailure()
29 f.Comment("a trailing zero is missing from the X25519 share")
30 f.Generate()
31 }