Botan 1.10.17
ecdsa_sig.h
Go to the documentation of this file.
1/*
2* ECDSA Signature
3* (C) 2007 Falko Strenzke, FlexSecure GmbH
4* (C) 2008-2010 Jack Lloyd
5*
6* Distributed under the terms of the Botan license
7*/
8
9#ifndef BOTAN_ECDSA_SIGNATURE_H__
10#define BOTAN_ECDSA_SIGNATURE_H__
11
12#include <botan/bigint.h>
13#include <botan/der_enc.h>
14#include <botan/ber_dec.h>
15
16namespace Botan {
17
18/**
19* Class representing an ECDSA signature
20*/
21class BOTAN_DLL ECDSA_Signature
22 {
23 public:
25
27 ECDSA_Signature(const BigInt& r, const BigInt& s) :
28 m_r(r), m_s(s) {}
29
31
32 const BigInt& get_r() const { return m_r; }
33 const BigInt& get_s() const { return m_s; }
34
35 /**
36 * return the r||s
37 */
38 MemoryVector<byte> get_concatenation() const;
39
40 MemoryVector<byte> DER_encode() const;
41
42 bool operator==(const ECDSA_Signature& other) const
43 {
44 return (get_r() == other.get_r() && get_s() == other.get_s());
45 }
46
47 private:
48 BigInt m_r;
49 BigInt m_s;
50 };
51
52inline bool operator!=(const ECDSA_Signature& lhs, const ECDSA_Signature& rhs)
53 {
54 return !(lhs == rhs);
55 }
56
57ECDSA_Signature decode_concatenation(const MemoryRegion<byte>& concatenation);
58
59}
60
61#endif
const BigInt & get_r() const
Definition ecdsa_sig.h:32
ECDSA_Signature(const BigInt &r, const BigInt &s)
Definition ecdsa_sig.h:27
const BigInt & get_s() const
Definition ecdsa_sig.h:33
friend class ECDSA_Signature_Decoder
Definition ecdsa_sig.h:24
bool operator==(const ECDSA_Signature &other) const
Definition ecdsa_sig.h:42
bool operator!=(const OctetString &s1, const OctetString &s2)
Definition symkey.cpp:106
ECDSA_Signature decode_concatenation(const MemoryRegion< byte > &concat)
Definition ecdsa_sig.cpp:46