Mercurial > vim
annotate src/testdir/test_crypt.vim @ 25139:7fa520b85244 v8.2.3106
patch 8.2.3106: Vim9: confusing line number reported for error
Commit: https://github.com/vim/vim/commit/6977dba04b68b91410585ada65079651788ca7dc
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jul 4 22:48:12 2021 +0200
patch 8.2.3106: Vim9: confusing line number reported for error
Problem: Vim9: confusing line number reported for error.
Solution: Use the start line number for the store instruction.
(closes #8488)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 04 Jul 2021 23:00:04 +0200 |
parents | 7e9e53a0368f |
children | 68f0093134b1 |
rev | line source |
---|---|
10221
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Tests for encryption. |
10231
cbee14cc4da6
commit https://github.com/vim/vim/commit/1eceadaf481e34ed8155011534159775697ce884
Christian Brabandt <cb@256bit.org>
parents:
10225
diff
changeset
|
2 |
17089
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
17049
diff
changeset
|
3 source check.vim |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
17049
diff
changeset
|
4 CheckFeature cryptv |
10221
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 func Common_head_only(text) |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 " This was crashing Vim |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 split Xtest.txt |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 call setline(1, a:text) |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 wq |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 call feedkeys(":split Xtest.txt\<CR>foobar\<CR>", "tx") |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 call delete('Xtest.txt') |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 call assert_match('VimCrypt', getline(1)) |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 bwipe! |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 endfunc |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 func Test_head_only_2() |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 call Common_head_only('VimCrypt~02!abc') |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 endfunc |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 func Test_head_only_3() |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 call Common_head_only('VimCrypt~03!abc') |
fb1fde4fcff7
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 endfunc |
10239
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
24 |
24970
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
25 func Test_head_only_4() |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
26 CheckFeature sodium |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
27 call Common_head_only('VimCrypt~04!abc') |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
28 endfunc |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
29 |
10239
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
30 func Crypt_uncrypt(method) |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
31 exe "set cryptmethod=" . a:method |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
32 " If the blowfish test fails 'cryptmethod' will be 'zip' now. |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
33 call assert_equal(a:method, &cryptmethod) |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
34 |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
35 split Xtest.txt |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
36 let text = ['01234567890123456789012345678901234567', |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
37 \ 'line 2 foo bar blah', |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
38 \ 'line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'] |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
39 call setline(1, text) |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
40 call feedkeys(":X\<CR>foobar\<CR>foobar\<CR>", 'xt') |
15531
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
41 call assert_equal('*****', &key) |
10239
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
42 w! |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
43 bwipe! |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
44 call feedkeys(":split Xtest.txt\<CR>foobar\<CR>", 'xt') |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
45 call assert_equal(text, getline(1, 3)) |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
46 set key= cryptmethod& |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
47 bwipe! |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
48 call delete('Xtest.txt') |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
49 endfunc |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
50 |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
51 func Test_crypt_zip() |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
52 call Crypt_uncrypt('zip') |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
53 endfunc |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
54 |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
55 func Test_crypt_blowfish() |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
56 call Crypt_uncrypt('blowfish') |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
57 endfunc |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
58 |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
59 func Test_crypt_blowfish2() |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
60 call Crypt_uncrypt('blowfish2') |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
61 endfunc |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
62 |
24970
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
63 func Test_crypt_sodium() |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
64 CheckFeature sodium |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
65 call Crypt_uncrypt('xchacha20') |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
66 endfunc |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
67 |
10239
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
68 func Uncrypt_stable(method, crypted_text, key, uncrypted_text) |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
69 split Xtest.txt |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
70 set bin noeol key= fenc=latin1 |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
71 exe "set cryptmethod=" . a:method |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
72 call setline(1, a:crypted_text) |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
73 w! |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
74 bwipe! |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
75 set nobin |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
76 call feedkeys(":split Xtest.txt\<CR>" . a:key . "\<CR>", 'xt') |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
77 call assert_equal(a:uncrypted_text, getline(1, len(a:uncrypted_text))) |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
78 bwipe! |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
79 call delete('Xtest.txt') |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
80 set key= |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
81 endfunc |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
82 |
24970
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
83 func Uncrypt_stable_xxd(method, hex, key, uncrypted_text) |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
84 " use xxd to write the binary content |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
85 call system('xxd -r >Xtest.txt', a:hex) |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
86 call feedkeys(":split Xtest.txt\<CR>" . a:key . "\<CR>", 'xt') |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
87 call assert_equal(a:uncrypted_text, getline(1, len(a:uncrypted_text))) |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
88 bwipe! |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
89 call delete('Xtest.txt') |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
90 set key= |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
91 endfunc |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
92 |
10239
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
93 func Test_uncrypt_zip() |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
94 call Uncrypt_stable('zip', "VimCrypt~01!\u0006\u001clV'\u00de}Mg\u00a0\u00ea\u00a3V\u00a9\u00e7\u0007E#3\u008e2U\u00e9\u0097", "foofoo", ["1234567890", "aábbccddeëff"]) |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
95 endfunc |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
96 |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
97 func Test_uncrypt_blowfish() |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
98 call Uncrypt_stable('blowfish', "VimCrypt~02!k)\u00be\u0017\u0097#\u0016\u00ddS\u009c\u00f5=\u00ba\u00e0\u00c8#\u00a5M\u00b4\u0086J\u00c3A\u00cd\u00a5M\u00b4\u0086!\u0080\u0015\u009b\u00f5\u000f\u00e1\u00d2\u0019\u0082\u0016\u0098\u00f7\u000d\u00da", "barbar", ["asdfasdfasdf", "0001112223333"]) |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
99 endfunc |
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
100 |
24970
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
101 func Test_uncrypt_blowfish2a() |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
102 call Uncrypt_stable('blowfish', "VimCrypt~03!\u001e\u00d1N\u00e3;\u00d3\u00c0\u00a0^C)\u0004\u00f7\u007f.\u00b6\u00abF\u000eS\u0019\u00e0\u008b6\u00d2[T\u00cb\u00a7\u0085\u00d8\u00be9\u000b\u00812\u000bQ\u00b3\u00cc@\u0097\u000f\u00df\u009a\u00adIv\u00aa.\u00d8\u00c9\u00ee\u009e`\u00bd$\u00af%\u00d0", "barburp", ["abcdefghijklmnopqrstuvwxyz", "!@#$%^&*()_+=-`~"]) |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
103 endfunc |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
104 |
10239
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
105 func Test_uncrypt_blowfish2() |
24970
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
106 call Uncrypt_stable('blowfish2', "VimCrypt~03!\u001e\u00d1N\u00e3;\u00d3\u00c0\u00a0^C)\u0004\u00f7\u007f.\u00b6\u00abF\u000eS\u0019\u00e0\u008b6\u00d2[T\u00cb\u00a7\u0085\u00d8\u00be9\u000b\u00812\u000bQ\u00b3\u00cc@\u0097\u000f\u00df\u009a\u00adIv\u00aa.\u00d8\u00c9\u00ee\u009e`\u00bd$\u00af%\u00d0", "barburp", ["abcdefghijklmnopqrstuvwxyz", "!@#$%^&*()_+=-`~"]) |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
107 endfunc |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
108 |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
109 func Test_uncrypt_xchacha20() |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
110 CheckFeature sodium |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
111 let hex=['00000000: 5669 6d43 7279 7074 7e30 3421 6b7d e607 vimCrypt~04!k}..', |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
112 \ '00000010: 4ea4 e99f 923e f67f 7b59 a80d 3bca 2f06 N....>..{Y..;./.', |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
113 \ '00000020: fa11 b951 8d09 0dc9 470f e7cf 8b90 4310 ...Q....G.....C.', |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
114 \ '00000030: 653b b83b e493 378b 0390 0e38 f912 626b e;.;..7....8..bk', |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
115 \ '00000040: a02e 4697 0254 2625 2d8e 3a0b 784b e89c ..F..T&%-.:.xK..', |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
116 \ '00000050: 0c67 a975 3c17 9319 8ffd 1463 7783 a1f3 .g.u<......cw...', |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
117 \ '00000060: d917 dcb3 8b3e ecd7 c7d4 086b 6059 7ead .....>.....k`Y~.', |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
118 \ '00000070: 9b07 f96b 5c1b 4d08 cd91 f208 5221 7484 ...k\.M.....R!t.', |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
119 \ '00000080: 72be 0136 84a1 d3 r..6...'] |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
120 " the file should be in latin1 encoding, this makes sure that readfile() |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
121 " retries several times converting the multi-byte characters |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
122 call Uncrypt_stable_xxd('xchacha20', hex, "sodium_crypt", ["abcdefghijklmnopqrstuvwxyzäöü", "ZZZ_äüöÄÜÖ_!@#$%^&*()_+=-`~"]) |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
123 endfunc |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
124 |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
125 func Test_uncrypt_xchacha20_invalid() |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
126 CheckFeature sodium |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
127 " load an invalid encrypted file and verify it can be decrypted with an |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
128 " error message |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
129 try |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
130 call feedkeys(":split samples/crypt_sodium_invalid.txt\<CR>sodium\<CR>", 'xt') |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
131 call assert_false(1, 'should not happen') |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
132 catch |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
133 call assert_exception('pre-mature') |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
134 endtry |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
135 call assert_match("Note: Encryption of swapfile not supported, disabling swap- and undofile", execute(':5messages')) |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
136 |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
137 call assert_equal(0, &swapfile) |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
138 call assert_equal("xchacha20", &cryptmethod) |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
139 call assert_equal('311111111111111111111111', getline('$')) |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
140 bw! |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
141 endfunc |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
142 |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
143 func Test_uncrypt_xchacha20_2() |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
144 CheckFeature sodium |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
145 sp Xcrypt_sodium.txt |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
146 " Create a larger file, so that Vim will write in several blocks |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
147 call setline(1, range(1,4000)) |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
148 call assert_equal(1, &swapfile) |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
149 set cryptmethod=xchacha20 |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
150 call feedkeys(":X\<CR>sodium\<CR>sodium\<CR>", 'xt') |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
151 " swapfile disabled |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
152 call assert_equal(0, &swapfile) |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
153 call assert_match("Note: Encryption of swapfile not supported, disabling swap- and undofile", execute(':messages')) |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
154 w! |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
155 " encrypted using xchacha20 |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
156 call assert_match("\[xchacha20\]", execute(':messages')) |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
157 bw! |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
158 call feedkeys(":sp Xcrypt_sodium.txt\<CR>sodium\<CR>", 'xt') |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
159 " successfully decrypted |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
160 call assert_equal(range(1, 4000)->map( {_, v -> string(v)}), getline(1,'$')) |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
161 set key= |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
162 w! |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
163 " enryption removed |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
164 call assert_match('"Xcrypt_sodium.txt" 4000L, 18893B written', execute(':message')) |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
165 bw! |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
166 call delete('Xcrypt_sodium.txt') |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
167 set cryptmethod&vim |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
168 endfunc |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
169 |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
170 func Test_uncrypt_xchacha20_3_persistent_undo() |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
171 CheckFeature sodium |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
172 CheckFeature persistent_undo |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
173 sp Xcrypt_sodium_undo.txt |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
174 set cryptmethod=xchacha20 undofile |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
175 call feedkeys(":X\<CR>sodium\<CR>sodium\<CR>", 'xt') |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
176 call assert_equal(0, &undofile) |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
177 let ufile=undofile(@%) |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
178 call append(0, ['monday', 'tuesday', 'wednesday', 'thursday', 'friday']) |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
179 call cursor(1, 1) |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
180 |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
181 set undolevels=100 |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
182 normal dd |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
183 set undolevels=100 |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
184 normal dd |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
185 set undolevels=100 |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
186 normal dd |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
187 set undolevels=100 |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
188 w! |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
189 bw! |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
190 call feedkeys(":sp Xcrypt_sodium_undo.txt\<CR>sodium\<CR>", 'xt') |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
191 " should fail |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
192 norm! u |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
193 call assert_match('Already at oldest change', execute(':1mess')) |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
194 call assert_fails('verbose rundo' .. fnameescape(ufile), 'E822') |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
195 bw! |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
196 set undolevels& cryptmethod& undofile& |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
197 call delete('Xcrypt_sodium_undo.txt') |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
198 endfunc |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
199 |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
200 func Test_encrypt_xchacha20_missing() |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
201 if has("sodium") |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
202 return |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
203 endif |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
204 sp Xcrypt_sodium_undo.txt |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
205 call assert_fails(':set cryptmethod=xchacha20', 'E474') |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
206 bw! |
7e9e53a0368f
patch 8.2.3022: available encryption methods are not strong enough
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
207 set cm& |
10239
ebbc8d21105b
commit https://github.com/vim/vim/commit/177778575148e265c0e32ec2abf2d2c615f5ead5
Christian Brabandt <cb@256bit.org>
parents:
10231
diff
changeset
|
208 endfunc |
15531
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
209 |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
210 func Test_uncrypt_unknown_method() |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
211 split Xuncrypt_unknown.txt |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
212 set bin noeol key= fenc=latin1 |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
213 call setline(1, "VimCrypt~93!\u001e\u00d1") |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
214 w! |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
215 bwipe! |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
216 set nobin |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
217 call assert_fails(":split Xuncrypt_unknown.txt", 'E821:') |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
218 |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
219 bwipe! |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
220 call delete('Xuncrypt_unknown.txt') |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
221 set key= |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
222 endfunc |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
223 |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
224 func Test_crypt_key_mismatch() |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
225 set cryptmethod=blowfish |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
226 |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
227 split Xtest.txt |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
228 call setline(1, 'nothing') |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
229 call feedkeys(":X\<CR>foobar\<CR>nothing\<CR>", 'xt') |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
230 call assert_match("Keys don't match!", execute(':2messages')) |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
231 call assert_equal('', &key) |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
232 call feedkeys("\<CR>\<CR>", 'xt') |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
233 |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
234 set cryptmethod& |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
235 bwipe! |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
236 endfunc |
959cf4c63b18
patch 8.1.0773: not all crypt code is tested
Bram Moolenaar <Bram@vim.org>
parents:
10239
diff
changeset
|
237 |
20415
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
238 func Test_crypt_set_key_changes_buffer() |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
239 |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
240 new Xtest1.txt |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
241 call setline(1, 'nothing') |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
242 set cryptmethod=blowfish2 |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
243 call feedkeys(":X\<CR>foobar\<CR>foobar\<CR>", 'xt') |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
244 call assert_fails(":q", "E37:") |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
245 w |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
246 set key=anotherkey |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
247 call assert_fails(":bw") |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
248 w |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
249 call feedkeys(":X\<CR>foobar\<CR>foobar\<CR>", 'xt') |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
250 call assert_fails(":bw") |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
251 w |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
252 let winnr = winnr() |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
253 wincmd p |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
254 call setwinvar(winnr, '&key', 'yetanotherkey') |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
255 wincmd p |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
256 call assert_fails(":bw") |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
257 w |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
258 |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
259 set cryptmethod& |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
260 set key= |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
261 bwipe! |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
262 call delete('Xtest1.txt') |
b582eb6ef192
patch 8.2.0762: buffer is not considered modified after setting crypt key
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
263 endfunc |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
20415
diff
changeset
|
264 |
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
20415
diff
changeset
|
265 " vim: shiftwidth=2 sts=2 expandtab |