Debian Codegraph @

age/internal/tests/armor_header_crlf.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 "bytes"
12
13 "c2sp.org/CCTV/age/internal/testkit"
14 )
15
16 func main() {
17 f := testkit.NewTestFile()
18 f.VersionLine("v1")
19 f.X25519(testkit.TestX25519Identity)
20 hdr := f.Buf.Bytes()
21 f.Buf.Reset()
22 f.Buf.Write(bytes.Replace(hdr, []byte("\n"), []byte("\r\n"), -1))
23 f.HMAC()
24 f.Buf.WriteString(f.UnreadLine() + "\r\n")
25 f.Payload("age")
26 f.ExpectHeaderFailure()
27 f.Comment("lines in the header end with CRLF instead of LF")
28 file := f.Bytes()
29 f.Buf.Reset()
30 f.BeginArmor("AGE ENCRYPTED FILE")
31 f.Body(file)
32 f.Base64Padding()
33 f.EndArmor("AGE ENCRYPTED FILE")
34 f.Generate()
35 }