| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 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 |
f.HMAC() |
| 21 |
f.Payload("age") |
| 22 |
file := f.Bytes() |
| 23 |
f.Buf.Reset() |
| 24 |
f.BeginArmor("AGE ENCRYPTED FILE") |
| 25 |
f.Body(file) |
| 26 |
f.Base64Padding() |
| 27 |
f.EndArmor("AGE ENCRYPTED FILE") |
| 28 |
armored := f.Bytes() |
| 29 |
f.Buf.Reset() |
| 30 |
f.Buf.Write(bytes.Replace(armored, []byte("\n"), []byte("\r\n"), -1)) |
| 31 |
f.Comment("CRLF is allowed as a end of line for armored files") |
| 32 |
f.Generate() |
| 33 |
} |