Botan  1.11.15
Public Member Functions | Friends
Botan::ECDSA_Signature Class Reference

#include <ecdsa_sig.h>

List of all members.

Public Member Functions

std::vector< byteDER_encode () const
 ECDSA_Signature ()
 ECDSA_Signature (const BigInt &r, const BigInt &s)
 ECDSA_Signature (const std::vector< byte > &ber)
std::vector< byteget_concatenation () const
const BigIntget_r () const
const BigIntget_s () const
bool operator== (const ECDSA_Signature &other) const

Friends

class ECDSA_Signature_Decoder

Detailed Description

Class representing an ECDSA signature

Definition at line 21 of file ecdsa_sig.h.


Constructor & Destructor Documentation

Definition at line 26 of file ecdsa_sig.h.

{}
Botan::ECDSA_Signature::ECDSA_Signature ( const BigInt r,
const BigInt s 
) [inline]

Definition at line 27 of file ecdsa_sig.h.

                                                        :
         m_r(r), m_s(s) {}
Botan::ECDSA_Signature::ECDSA_Signature ( const std::vector< byte > &  ber)

Definition at line 13 of file ecdsa_sig.cpp.

References Botan::BER_Decoder::decode(), Botan::BER_Decoder::end_cons(), Botan::SEQUENCE, Botan::BER_Decoder::start_cons(), and Botan::BER_Decoder::verify_end().

   {
   BER_Decoder(ber)
      .start_cons(SEQUENCE)
         .decode(m_r)
         .decode(m_s)
      .end_cons()
      .verify_end();
   }

Member Function Documentation

std::vector< byte > Botan::ECDSA_Signature::DER_encode ( ) const

Definition at line 23 of file ecdsa_sig.cpp.

References Botan::DER_Encoder::encode(), Botan::DER_Encoder::end_cons(), Botan::DER_Encoder::get_contents_unlocked(), get_r(), get_s(), Botan::SEQUENCE, and Botan::DER_Encoder::start_cons().

Referenced by Botan::EAC1_1_obj< EAC1_1_Req >::check_signature().

   {
   return DER_Encoder()
      .start_cons(SEQUENCE)
        .encode(get_r())
        .encode(get_s())
      .end_cons()
      .get_contents_unlocked();
   }

return the r||s

Definition at line 33 of file ecdsa_sig.cpp.

References Botan::BigInt::bytes(), Botan::BigInt::encode_1363(), and Botan::unlock().

Referenced by Botan::EAC1_1_obj< EAC1_1_Req >::get_concat_sig().

   {
   // use the larger
   const size_t enc_len = m_r > m_s ? m_r.bytes() : m_s.bytes();

   const auto sv_r = BigInt::encode_1363(m_r, enc_len);
   const auto sv_s = BigInt::encode_1363(m_s, enc_len);

   secure_vector<byte> result(sv_r);
   result += sv_s;
   return unlock(result);
   }
const BigInt& Botan::ECDSA_Signature::get_r ( ) const [inline]

Definition at line 32 of file ecdsa_sig.h.

Referenced by DER_encode(), and operator==().

{ return m_r; }
const BigInt& Botan::ECDSA_Signature::get_s ( ) const [inline]

Definition at line 33 of file ecdsa_sig.h.

Referenced by DER_encode(), and operator==().

{ return m_s; }
bool Botan::ECDSA_Signature::operator== ( const ECDSA_Signature other) const [inline]

Definition at line 42 of file ecdsa_sig.h.

References get_r(), and get_s().

         {
         return (get_r() == other.get_r() && get_s() == other.get_s());
         }

Friends And Related Function Documentation

friend class ECDSA_Signature_Decoder [friend]

Definition at line 24 of file ecdsa_sig.h.


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