Botan
1.11.15
|
#include <emsa_pkcs1.h>
Public Types | |
typedef SCAN_Name | Spec |
Public Member Functions | |
EMSA_PKCS1v15 (HashFunction *hash) | |
secure_vector< byte > | encoding_of (const secure_vector< byte > &, size_t, RandomNumberGenerator &rng) |
secure_vector< byte > | raw_data () |
void | update (const byte[], size_t) |
bool | verify (const secure_vector< byte > &, const secure_vector< byte > &, size_t) |
PKCS #1 v1.5 signature padding aka PKCS #1 block type 1 aka EMSA3 from IEEE 1363
Definition at line 21 of file emsa_pkcs1.h.
typedef SCAN_Name Botan::EMSA::Spec [inherited] |
hash | the hash object to use |
Definition at line 91 of file emsa_pkcs1.cpp.
References Botan::pkcs_hash_id().
: m_hash(hash) { m_hash_id = pkcs_hash_id(m_hash->name()); }
secure_vector< byte > Botan::EMSA_PKCS1v15::encoding_of | ( | const secure_vector< byte > & | msg, |
size_t | output_bits, | ||
RandomNumberGenerator & | rng | ||
) | [virtual] |
Return the encoding of a message
msg | the result of raw_data() |
output_bits | the desired output bit size |
rng | a random number generator |
Implements Botan::EMSA.
Definition at line 62 of file emsa_pkcs1.cpp.
{ if(msg.size() != m_hash->output_length()) throw Encoding_Error("EMSA_PKCS1v15::encoding_of: Bad input length"); return emsa3_encoding(msg, output_bits, &m_hash_id[0], m_hash_id.size()); }
secure_vector< byte > Botan::EMSA_PKCS1v15::raw_data | ( | ) | [virtual] |
Implements Botan::EMSA.
Definition at line 56 of file emsa_pkcs1.cpp.
{ return m_hash->final(); }
void Botan::EMSA_PKCS1v15::update | ( | const byte | input[], |
size_t | length | ||
) | [virtual] |
Add more data to the signature computation
input | some data |
length | length of input in bytes |
Implements Botan::EMSA.
Definition at line 51 of file emsa_pkcs1.cpp.
{ m_hash->update(input, length); }
bool Botan::EMSA_PKCS1v15::verify | ( | const secure_vector< byte > & | coded, |
const secure_vector< byte > & | raw, | ||
size_t | key_bits | ||
) | [virtual] |
Verify the encoding
coded | the received (coded) message representative |
raw | the computed (local, uncoded) message representative |
key_bits | the size of the key in bits |
Implements Botan::EMSA.
Definition at line 73 of file emsa_pkcs1.cpp.
{ if(raw.size() != m_hash->output_length()) return false; try { return (coded == emsa3_encoding(raw, key_bits, &m_hash_id[0], m_hash_id.size())); } catch(...) { return false; } }