]> git.ipfire.org Git - thirdparty/pdns.git/blame - pdns/pkcs11signers.hh
auth: switch circleci mssql image
[thirdparty/pdns.git] / pdns / pkcs11signers.hh
CommitLineData
12471842
PL
1/*
2 * This file is part of PowerDNS or dnsdist.
3 * Copyright -- PowerDNS.COM B.V. and its contributors
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * In addition, for the avoidance of any doubt, permission is granted to
10 * link this program with OpenSSL and to (re)distribute the binaries
11 * produced as the result of such linking.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
680f25f8
RK
22#ifndef PDNS_PKCS11SIGNERS_HH
23#define PDNS_PKCS11SIGNERS_HH
24
8daea594
AT
25class PKCS11DNSCryptoKeyEngine : public DNSCryptoKeyEngine
26{
27 protected:
806d64bd 28 std::string d_module;
248d701f 29 std::string d_slot_id;
8daea594
AT
30 std::string d_pin;
31 std::string d_label;
9ee32859 32 std::string d_pub_label;
8daea594
AT
33
34 public:
35 PKCS11DNSCryptoKeyEngine(unsigned int algorithm);
36 ~PKCS11DNSCryptoKeyEngine();
37
38 bool operator<(const PKCS11DNSCryptoKeyEngine& rhs) const
39 {
40 return false;
41 }
42 PKCS11DNSCryptoKeyEngine(const PKCS11DNSCryptoKeyEngine& orig);
43
e69c2dac 44 string getName() const override { return "P11 Kit PKCS#11"; };
8daea594 45
e69c2dac 46 void create(unsigned int bits) override;
8daea594 47
e69c2dac 48 storvector_t convertToISCVector() const override;
8daea594 49
e69c2dac 50 std::string sign(const std::string& msg) const override;
8daea594 51
e69c2dac 52 std::string hash(const std::string& msg) const override;
8daea594 53
e69c2dac 54 bool verify(const std::string& msg, const std::string& signature) const override;
8daea594 55
e69c2dac 56 std::string getPubKeyHash() const override;
8daea594 57
e69c2dac
RG
58 std::string getPublicKeyString() const override;
59 int getBits() const override;
8daea594 60
e69c2dac 61 void fromISCMap(DNSKEYRecordContent& drc, stormap_t& stormap) override;
8daea594 62
e69c2dac
RG
63 void fromPEMString(DNSKEYRecordContent& drc, const std::string& raw) override { throw "Unimplemented"; };
64 void fromPublicKeyString(const std::string& content) override { throw "Unimplemented"; };
8daea594 65
e69c2dac 66 static std::shared_ptr<DNSCryptoKeyEngine> maker(unsigned int algorithm);
8daea594
AT
67};
68
248d701f 69bool PKCS11ModuleSlotLogin(const std::string& module, const string& tokenId, const std::string& pin);
24e0b305 70
680f25f8 71#endif /* PDNS_PKCS11SIGNERS_HH */