(t *testing.T)
| 295 | } |
| 296 | |
| 297 | func TestDecryptSegmentBase64(t *testing.T) { |
| 298 | // We've tested the forwards above, now concentrate on the errors |
| 299 | longName := make([]byte, 2816) |
| 300 | for i := range longName { |
| 301 | longName[i] = 'a' |
| 302 | } |
| 303 | enc, _ := NewNameEncoding("base64") |
| 304 | c, _ := newCipher(NameEncryptionStandard, "", "", true, enc) |
| 305 | for _, test := range []struct { |
| 306 | in string |
| 307 | expectedErr error |
| 308 | }{ |
| 309 | {"6H=", base64.CorruptInputError(2)}, |
| 310 | {"!", base64.CorruptInputError(0)}, |
| 311 | {string(longName), ErrorTooLongAfterDecode}, |
| 312 | {enc.EncodeToString([]byte("a")), ErrorNotAMultipleOfBlocksize}, |
| 313 | {enc.EncodeToString([]byte("123456789abcdef")), ErrorNotAMultipleOfBlocksize}, |
| 314 | {enc.EncodeToString([]byte("123456789abcdef0")), pkcs7.ErrorPaddingTooLong}, |
| 315 | } { |
| 316 | actual, actualErr := c.decryptSegment(test.in) |
| 317 | assert.Equal(t, test.expectedErr, actualErr, fmt.Sprintf("in=%q got actual=%q, err = %v %T", test.in, actual, actualErr, actualErr)) |
| 318 | } |
| 319 | } |
| 320 | |
| 321 | func TestDecryptSegmentBase32768(t *testing.T) { |
| 322 | // We've tested the forwards above, now concentrate on the errors |
nothing calls this directly
no test coverage detected
searching dependent graphs…