Botan  2.8.0
Crypto and TLS for C++11
Public Member Functions | List of all members
Botan::EMSA_X931 Class Referencefinal

#include <emsa_x931.h>

Inheritance diagram for Botan::EMSA_X931:
Botan::EMSA

Public Member Functions

EMSAclone () override
 
virtual AlgorithmIdentifier config_for_x509 (const Private_Key &key, const std::string &cert_hash_name) const
 
 EMSA_X931 (HashFunction *hash)
 
std::string name () const override
 

Detailed Description

EMSA from X9.31 (EMSA2 in IEEE 1363) Useful for Rabin-Williams, also sometimes used with RSA in odd protocols.

Definition at line 21 of file emsa_x931.h.

Constructor & Destructor Documentation

◆ EMSA_X931()

Botan::EMSA_X931::EMSA_X931 ( HashFunction hash)
explicit
Parameters
hashthe hash function to use

Definition at line 92 of file emsa_x931.cpp.

92  : m_hash(hash)
93  {
94  m_empty_hash = m_hash->final();
95 
96  m_hash_id = ieee1363_hash_id(hash->name());
97 
98  if(!m_hash_id)
99  throw Encoding_Error("EMSA_X931 no hash identifier for " + hash->name());
100  }
uint8_t ieee1363_hash_id(const std::string &name)
Definition: hash_id.cpp:146
MechanismType hash

Member Function Documentation

◆ clone()

EMSA* Botan::EMSA_X931::clone ( )
inlineoverridevirtual
Returns
a new object representing the same encoding method as *this

Implements Botan::EMSA.

Definition at line 29 of file emsa_x931.h.

29 { return new EMSA_X931(m_hash->clone()); }
EMSA_X931(HashFunction *hash)
Definition: emsa_x931.cpp:92

◆ config_for_x509()

AlgorithmIdentifier Botan::EMSA::config_for_x509 ( const Private_Key key,
const std::string &  cert_hash_name 
) const
virtualinherited

Prepare sig_algo for use in choose_sig_format for x509 certs

Parameters
keyused for checking compatibility with the encoding scheme
cert_hash_nameis checked to equal the hash for the encoding
Returns
algorithm identifier to signatures created using this key, padding method and hash.

Reimplemented in Botan::EMSA_PKCS1v15, Botan::PSSR, and Botan::EMSA1.

Definition at line 38 of file emsa.cpp.

References Botan::EMSA::name().

40  {
41  throw Not_Implemented("Encoding " + name() + " not supported for signing X509 objects");
42  }
virtual std::string name() const =0

◆ name()

std::string Botan::EMSA_X931::name ( ) const
overridevirtual
Returns
the SCAN name of the encoding/padding scheme

Implements Botan::EMSA.

Definition at line 46 of file emsa_x931.cpp.

47  {
48  return "EMSA2(" + m_hash->name() + ")";
49  }

The documentation for this class was generated from the following files: