Botan  1.10.9
emsa1_bsi.cpp
Go to the documentation of this file.
1 /*
2 * EMSA1 BSI
3 * (C) 1999-2008 Jack Lloyd
4 * 2008 Falko Strenzke, FlexSecure GmbH
5 *
6 * Distributed under the terms of the Botan license
7 */
8 
9 #include <botan/emsa1_bsi.h>
10 
11 namespace Botan {
12 
13 /*
14 * EMSA1 BSI Encode Operation
15 */
16 SecureVector<byte> EMSA1_BSI::encoding_of(const MemoryRegion<byte>& msg,
17  size_t output_bits,
18  RandomNumberGenerator&)
19  {
20  if(msg.size() != hash_ptr()->output_length())
21  throw Encoding_Error("EMSA1_BSI::encoding_of: Invalid size for input");
22 
23  if(8*msg.size() <= output_bits)
24  return msg;
25 
26  throw Encoding_Error("EMSA1_BSI::encoding_of: max key input size exceeded");
27  }
28 
29 }
const HashFunction * hash_ptr() const
Definition: emsa1.h:32
virtual size_t output_length() const =0