Commit b5a8f7d
authored
Make encryptor error-wrapping test deterministic (cloudfoundry#5110)
The "raises an EncryptorError" test relied on AES-CBC + PKCS#7
producing invalid padding when decrypting with the wrong key. With a
random plaintext, padding is coincidentally valid ~1/256 of the time
(dominated by the last byte being 0x01), so cipher.final returns
garbage instead of raising and the test flakes.
Stub OpenSSL::Cipher#final to raise CipherError so the test exercises
the rescue/wrap logic in run_cipher deterministically. Add a parallel
test in the "no key label" context, since the same wrapping applies
there.1 parent cb73f4b commit b5a8f7d
1 file changed
Lines changed: 12 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
164 | 173 | | |
165 | 174 | | |
166 | 175 | | |
| |||
176 | 185 | | |
177 | 186 | | |
178 | 187 | | |
179 | | - | |
180 | | - | |
| 188 | + | |
181 | 189 | | |
| 190 | + | |
182 | 191 | | |
183 | 192 | | |
184 | 193 | | |
185 | | - | |
| 194 | + | |
186 | 195 | | |
187 | 196 | | |
188 | 197 | | |
| |||
0 commit comments