AusweisApp
Lade ...
Suche ...
Keine Treffer
EcdsaPublicKey.h
gehe zur Dokumentation dieser Datei
1
5#pragma once
6
7#include "ASN1TemplateUtil.h"
8#include "SecurityProtocol.h"
9
10#include <QByteArray>
11#include <QSharedPointer>
12
13#include <openssl/asn1t.h>
14#include <openssl/evp.h>
15
16#include <openssl/ec.h>
17
18
19namespace governikus
20{
21
43{
45 ASN1_OCTET_STRING* mPrimeModulus;
46 ASN1_OCTET_STRING* mFirstCoefficient;
47 ASN1_OCTET_STRING* mSecondCoefficient;
48 ASN1_OCTET_STRING* mBasePoint;
49 ASN1_OCTET_STRING* mOrderOfTheBasePoint;
50 ASN1_OCTET_STRING* mPublicPoint;
51 ASN1_OCTET_STRING* mCofactor;
52
55 QByteArray encode();
56
57 [[nodiscard]] bool isComplete() const;
59
63 [[nodiscard]] Oid getOid() const;
65
73
74#ifndef QT_NO_DEBUG
75
81 [[nodiscard]] QSharedPointer<EVP_PKEY> createKey() const;
82#endif
83
84 private:
85 struct CurveData
86 {
87 QSharedPointer<BIGNUM> p;
88 QSharedPointer<BIGNUM> a;
89 QSharedPointer<BIGNUM> b;
90 QSharedPointer<BIGNUM> order;
91 QSharedPointer<BIGNUM> cofactor;
92
93 [[nodiscard]] bool isValid() const
94 {
95 return !p.isNull() && !a.isNull() && !b.isNull() && !order.isNull();
96 }
97
98
99 };
100
101 [[nodiscard]] static bool isAllValid(const ecdsapublickey_st* pKey);
102 [[nodiscard]] static bool isAllInvalid(const ecdsapublickey_st* pKey);
103
107
108 public:
109 static int decodeCallback(int pOperation, ASN1_VALUE** pVal, const ASN1_ITEM* pIt, void* pExarg);
110};
111
112
115
116} // namespace governikus
#define DECLARE_ASN1_OBJECT(name)
Definition ASN1TemplateUtil.h:177
QByteArray fromHex(const std::string &pString)
Definition SmartManager.cpp:41
Implementation of GeneralAuthenticate response APDUs.
Definition CommandApdu.h:17
struct ecdsapublickey_st { ASN1_OBJECT *mObjectIdentifier; ASN1_OCTET_STRING *mPrimeModulus; ASN1_OCTET_STRING *mFirstCoefficient; ASN1_OCTET_STRING *mSecondCoefficient; ASN1_OCTET_STRING *mBasePoint; ASN1_OCTET_STRING *mOrderOfTheBasePoint; ASN1_OCTET_STRING *mPublicPoint; ASN1_OCTET_STRING *mCofactor; static QSharedPointer< ecdsapublickey_st > fromHex(const QByteArray &pHexValue); static QSharedPointer< ecdsapublickey_st > decode(const QByteArray &pBytes); QByteArray encode();[[nodiscard]] bool isComplete() const ;[[nodiscard]] SecurityProtocol getSecurityProtocol() const ;[[nodiscard]] Oid getOid() const ;[[nodiscard]] QByteArray getUncompressedPublicPoint() const ;[[nodiscard]] QSharedPointer< EVP_PKEY > createKey(const QByteArray &pPublicPoint) const ;[[nodiscard]] QSharedPointer< EVP_PKEY > createKey() const ; private: struct CurveData { QSharedPointer< BIGNUM > p; QSharedPointer< BIGNUM > a; QSharedPointer< BIGNUM > b; QSharedPointer< BIGNUM > order; QSharedPointer< BIGNUM > cofactor;[[nodiscard]] bool isValid() const { return !p.isNull() &&!a.isNull() &&!b.isNull() &&!order.isNull(); } };[[nodiscard]] static bool isAllValid(const ecdsapublickey_st *pKey);[[nodiscard]] static bool isAllInvalid(const ecdsapublickey_st *pKey);[[nodiscard]] CurveData createCurveData() const ;[[nodiscard]] QSharedPointer< EVP_PKEY > createKey(const uchar *pPublicPoint, int pPublicPointLength) const ;[[nodiscard]] QSharedPointer< EC_GROUP > createGroup(const CurveData &pData) const ; public: static int decodeCallback(int pOperation, ASN1_VALUE **pVal, const ASN1_ITEM *pIt, void *pExarg);} EcdsaPublicKey
According to TR-03110-3 chapter D elliptic curve public keys are defined as follows:
Definition EcdsaPublicKey.h:42
QSharedPointer< T > decodeObject(const QByteArray &pData, bool pLogging=true)
Template function for decoding an OpenSSL type from DER encoded QByteArray.
Definition ASN1TemplateUtil.h:114