| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
package main |
| 9 |
|
| 10 |
import ( |
| 11 |
"strings" |
| 12 |
|
| 13 |
"c2sp.org/CCTV/age/internal/testkit" |
| 14 |
) |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
func main() { |
| 20 |
f := testkit.NewTestFile() |
| 21 |
f.VersionLine("v1") |
| 22 |
f.X25519(testkit.TestX25519Recipient) |
| 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 |
} |