Add test support for "oneshot" versions EVP_DigestSign, EVP_DigestVerify.
[openssl.git] / test / evpencod.txt
1 #
2 # Copyright 2001-2017 The OpenSSL Project Authors. All Rights Reserved.
3 #
4 # Licensed under the OpenSSL license (the "License").  You may not use
5 # this file except in compliance with the License.  You can obtain a copy
6 # in the file LICENSE in the source distribution or at
7 # https://www.openssl.org/source/license.html
8
9 # Tests start with one of these keywords
10 #       Cipher Decrypt Derive Digest Encoding KDF MAC PBE
11 #       PrivPubKeyPair Sign Verify VerifyRecover
12 # and continue until a blank line.  Lines starting with a pound sign,
13 # like this prolog, are ignored.
14
15 Title = Base64 tests
16 Encoding = canonical
17 Input = ""
18 Output = ""
19
20 Encoding = canonical
21 Input = "h"
22 Output = "aA==\n"
23
24 Encoding = canonical
25 Input = "hello"
26 Output = "aGVsbG8=\n"
27
28 Encoding = canonical
29 Input = "hello world!"
30 Output = "aGVsbG8gd29ybGQh\n"
31
32 Encoding = canonical
33 Input = 00010203040506070809a0b0c0d0e0f000
34 Output = "AAECAwQFBgcICaCwwNDg8AA=\n"
35
36 # Missing padding
37 Encoding = invalid
38 Output = "aGVsbG8"
39
40 Encoding = invalid
41 Output = "aGVsbG8\n"
42
43 # Tolerate missing newline
44 Encoding = valid
45 Input = "hello"
46 Output = "aGVsbG8="
47
48 # Don't tolerate extra trailing '='
49 Encoding = invalid
50 Input = "hello"
51 Output = "aGVsbG8==\n"
52
53 Encoding = invalid
54 Output = "aGVsbG8===\n"
55
56 # Don't tolerate data after '='
57 Encoding = invalid
58 Output = "aGV=sbG8=\n"
59
60 # Newlines are ignored
61 Encoding = valid
62 Input = "hello"
63 Output = "aGV\nsbG8=\n"
64
65 Encoding = canonical
66 Input = "hello"
67 Output = 614756736247383d0a
68
69 # Invalid characters
70 Encoding = invalid
71 Output = 614756736247383d0a00
72
73 Encoding = invalid
74 Output = 61475600736247383d0a
75
76 Encoding = invalid
77 Output = 61475601736247383d0a
78
79 Encoding = invalid
80 Output = 61475680736247383d0a
81
82 Encoding = invalid
83 Output = e14756736247383d0a
84
85 Encoding = canonical
86 Input = "OpenSSLOpenSSL\n"
87 Output = "T3BlblNTTE9wZW5TU0wK\n"
88
89 Encoding = valid
90 Input = "OpenSSLOpenSSL\n"
91 Output = "T3BlblNTTE9wZW5TU0wK"
92
93 # Truncate 1-3 chars
94 Encoding = invalid
95 Output = "T3BlblNTTE9wZW5TU0w"
96
97 Encoding = invalid
98 Output = "T3BlblNTTE9wZW5TU0"
99
100 Encoding = invalid
101 Output = "T3BlblNTTE9wZW5TU"
102
103 Encoding = invalid
104 Output = "T3BlblNTTE9wZW5TU0wK===="
105
106 Encoding = invalid
107 Output = "T3BlblNTTE9wZW5TU0wK============================================\n"
108
109 Encoding = invalid
110 Output = "YQ==YQ==YQ==\n"
111
112 Encoding = invalid
113 Output = "A"
114
115 Encoding = invalid
116 Output = "A\n"
117
118 Encoding = invalid
119 Output = "A="
120
121 Encoding = invalid
122 Output = "A==\n"
123
124 Encoding = invalid
125 Output = "A===\n"
126
127 Encoding = invalid
128 Output = "A====\n"
129
130 Encoding = valid
131 Input = "OpenSSLOpenSSL\n"
132 Output = "T3BlblNTTE9wZW5TU0wK\n\n"
133
134 Encoding = valid
135 Input = "OpenSSLOpenSSL\n"
136 Output = "T3BlblNTTE\n9wZW5TU0wK"
137
138 # CVE 2015-0292
139 Encoding = invalid
140 Output = "ZW5jb2RlIG1lCg==================================================================\n"
141
142 Encoding = canonical
143 Input = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
144 Output = "eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eA==\n"
145
146 Encoding = valid
147 Input = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
148 Output = "eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eA\n==\n"
149
150 Encoding = valid
151 Input = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
152 Output = "eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eA=\n=\n"
153
154 Encoding = invalid
155 Output = "eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eA====\n"
156
157 # Multiline output without padding
158 Encoding = canonical
159 Input = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
160 Output = "eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4\neHh4eHh4eHh4eHh4\n"
161
162 # Multiline output with padding
163 Encoding = canonical
164 Input = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
165 Output = "eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4\neHh4eHh4eHh4eHh4eHh4eA==\n"
166
167 # Multiline output with line break in the middle of a b64 block is accepted
168 Encoding = valid
169 Input = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
170 Output = "eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh\n4eHh4eHh4eHh4eHh4eHh4eA==\n"
171
172 # Long lines are accepted
173 Encoding = valid
174 Input = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
175 Output = "eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eA==\n"
176
177 # Multiline input with data after '='.
178 Encoding = invalid
179 Output = "eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eA==\neHh4eHh4eHh4eHh4eHh4eHh4\n"
180
181 Encoding = invalid
182 Output = "eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4\neA==eHh4eHh4eHh4eHh4eHh4\n"
183
184 # B64_EOF ('-') terminates input and trailing bytes are ignored
185 Encoding = valid
186 Input = "OpenSSLOpenSSL\n"
187 Output = "T3BlblNTTE9wZW5TU0wK\n-abcd"
188
189 Encoding = valid
190 Input = "OpenSSLOpenSSL\n"
191 Output = "T3BlblNTTE9wZW5TU0wK-abcd"
192
193