Debian Codegraph @

age/internal/tests/hybrid_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.HybridRecordIdentity(testkit.TestHybridIdentity)
22 f.HybridStanza(share, f.Rand(32), testkit.TestHybridIdentity)
23 body, args := f.UnreadLine(), f.UnreadArgsLine()
24 enc, _ := base64.RawStdEncoding.DecodeString(args[1])
25 f.TextLine("-> mlkem768x25519 " + base64.RawStdEncoding.EncodeToString(append(enc, 0x00)))
26 f.TextLine(body)
27 f.HMAC()
28 f.Payload("age")
29 f.ExpectHeaderFailure()
30 f.Comment("an extra most-significant zero byte is appended to the X25519 part of enc")
31 f.Generate()
32 }