8 #include <botan/eme_pkcs.h>     9 #include <botan/internal/ct_utils.h>    16 SecureVector<byte> EME_PKCS1v15::pad(
const byte in[], 
size_t inlen,
    18                                      RandomNumberGenerator& rng)
 const    23       throw Encoding_Error(
"PKCS1: Output space too small");
    25       throw Encoding_Error(
"PKCS1: Input is too large");
    27    SecureVector<byte> out(olen);
    30    for(
size_t j = 1; j != olen - inlen - 1; ++j)
    32          out[j] = rng.next_byte();
    33    out.copy(olen - inlen, in, inlen);
    41 SecureVector<byte> EME_PKCS1v15::unpad(
const byte in[], 
size_t inlen,
    49    bad_input_m |= ~CT::is_equal<byte>(in[0], 2);
    51    for(
size_t i = 1; i < inlen; ++i)
    53       const byte is_zero_m = CT::is_zero<byte>(in[i]);
    55       delim_idx += CT::select<byte>(~seen_zero_m, 1, 0);
    57       bad_input_m |= is_zero_m & CT::expand_mask<byte>(i < 9);
    58       seen_zero_m |= is_zero_m;
    61    bad_input_m |= ~seen_zero_m;
    62    bad_input_m |= CT::is_less<size_t>(delim_idx, 8);
    64    SecureVector<byte> output(&in[delim_idx + 1], inlen - (delim_idx + 1));
    67       throw Decoding_Error(
"EME_PKCS1v15::unpad invalid ciphertext");
    77       return ((keybits / 8) - 10);
 size_t maximum_input_size(size_t) const