| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
package main |
| 9 |
|
| 10 |
import ( |
| 11 |
"encoding/base64" |
| 12 |
"encoding/hex" |
| 13 |
|
| 14 |
"c2sp.org/CCTV/age/internal/testkit" |
| 15 |
) |
| 16 |
|
| 17 |
func main() { |
| 18 |
f := testkit.NewTestFile() |
| 19 |
f.VersionLine("v1") |
| 20 |
share, _ := hex.DecodeString("97ba38a135fd5f9137fca3836bfec24340ab03d7ca316b26f482636334a52600") |
| 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 |
if enc[len(enc)-1] != 0x00 { |
| 26 |
panic("expected trailing zero byte") |
| 27 |
} |
| 28 |
f.TextLine("-> mlkem768x25519 " + base64.RawStdEncoding.EncodeToString(enc[:len(enc)-1])) |
| 29 |
f.TextLine(body) |
| 30 |
f.HMAC() |
| 31 |
f.Payload("age") |
| 32 |
f.ExpectHeaderFailure() |
| 33 |
f.Comment("a trailing zero is missing from the X25519 part of enc") |
| 34 |
f.Generate() |
| 35 |
} |