-
-
Notifications
You must be signed in to change notification settings - Fork 469
/
terminal.txt
56 lines (48 loc) · 1.28 KB
/
terminal.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
[windows] skip # no pty support
# controlling terminal is used instead of stdin/stderr
pty terminal
age -p -o test.age input
! stderr .
# autogenerated passphrase is printed to terminal
pty empty
age -p -o test.age input
ptyout 'autogenerated passphrase'
! stderr .
# with no controlling terminal, stdin terminal is used
## TODO: enable once https://golang.org/issue/53601 is fixed
## and Noctty is added to testscript.
# noctty
# pty -stdin terminal
# age -p -o test.age input
# ! stderr .
# no terminal causes an error
## TODO: enable once https://golang.org/issue/53601 is fixed
## and Noctty is added to testscript.
# noctty
# ! age -p -o test.age input
# stderr 'standard input is not a terminal'
# prompt for password before plaintext if stdin is the terminal
exec cat terminal input # concatenated password + input
pty -stdin stdout
age -p -a -o test.age
ptyout 'Enter passphrase'
! stderr .
# check the file was encrypted correctly
pty terminal
age -d test.age
cmp stdout input
# buffer armored ciphertext before prompting if stdin is the terminal
pty terminal
age -p -a -o test.age input
exec cat test.age terminal # concatenated ciphertext + password
pty -stdin stdout
age -d
ptyout 'Enter passphrase'
! stderr .
cmp stdout input
-- input --
test
-- terminal --
password
password
-- empty --