Botan 1.10.17
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
11namespace Botan {
12
13/*
14* EMSA1 BSI Encode Operation
15*/
16SecureVector<byte> EMSA1_BSI::encoding_of(const MemoryRegion<byte>& msg,
17 size_t output_bits,
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
Encoding_Error(const std::string &name)
Definition exceptn.h:131