Debian Codegraph @

age/internal/tests/armor_eol_between_padding.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 "strings"
12
13 "c2sp.org/CCTV/age/internal/testkit"
14 )
15
16 // See base64finl in RFC 7468.
17 // ; ...AB= <EOL> = <EOL> is not good, but is valid
18
19 func main() {
20 f := testkit.NewTestFile()
21 f.VersionLine("v1")
22 f.X25519(testkit.TestX25519Identity)
23 f.HMAC()
24 f.Payload("age12")
25 file := f.Bytes()
26 f.Buf.Reset()
27 f.BeginArmor("AGE ENCRYPTED FILE")
28 f.Body(file)
29 f.Base64Padding()
30 line := f.UnreadLine()
31 if !strings.Contains(line, "==") {
32 panic("need two padding characters")
33 }
34 line = strings.Replace(line, "==", "=\n=", 1)
35 f.TextLine(line)
36 f.EndArmor("AGE ENCRYPTED FILE")
37 f.ExpectArmorFailure()
38 f.Generate()
39 }