Botan  1.11.15
src/lib/pk_pad/emsa1_bsi/emsa1_bsi.cpp
Go to the documentation of this file.
00001 /*
00002 * EMSA1 BSI
00003 * (C) 1999-2008 Jack Lloyd
00004 *     2008 Falko Strenzke, FlexSecure GmbH
00005 *
00006 * Botan is released under the Simplified BSD License (see license.txt)
00007 */
00008 
00009 #include <botan/internal/pad_utils.h>
00010 #include <botan/emsa1_bsi.h>
00011 
00012 namespace Botan {
00013 
00014 BOTAN_REGISTER_EMSA_1HASH(EMSA1_BSI, "EMSA1_BSI");
00015 
00016 /*
00017 * EMSA1 BSI Encode Operation
00018 */
00019 secure_vector<byte> EMSA1_BSI::encoding_of(const secure_vector<byte>& msg,
00020                                           size_t output_bits,
00021                                           RandomNumberGenerator&)
00022    {
00023    if(msg.size() != hash_output_length())
00024       throw Encoding_Error("EMSA1_BSI::encoding_of: Invalid size for input");
00025 
00026    if(8*msg.size() <= output_bits)
00027       return msg;
00028 
00029    throw Encoding_Error("EMSA1_BSI::encoding_of: max key input size exceeded");
00030    }
00031 
00032 }