]> git.ipfire.org Git - thirdparty/pdns.git/blame - pdns/pkcs11signers.hh
Merge pull request #14021 from Habbie/auth-lua-join-whitespace
[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 */
e8c59f2d 22#pragma once
680f25f8 23
8daea594
AT
24class PKCS11DNSCryptoKeyEngine : public DNSCryptoKeyEngine
25{
26 protected:
806d64bd 27 std::string d_module;
248d701f 28 std::string d_slot_id;
8daea594
AT
29 std::string d_pin;
30 std::string d_label;
9ee32859 31 std::string d_pub_label;
8daea594
AT
32
33 public:
34 PKCS11DNSCryptoKeyEngine(unsigned int algorithm);
9a315393 35 ~PKCS11DNSCryptoKeyEngine() override;
8daea594 36
8daea594
AT
37 PKCS11DNSCryptoKeyEngine(const PKCS11DNSCryptoKeyEngine& orig);
38
e69c2dac 39 string getName() const override { return "P11 Kit PKCS#11"; };
8daea594 40
e69c2dac 41 void create(unsigned int bits) override;
8daea594 42
e69c2dac 43 storvector_t convertToISCVector() const override;
8daea594 44
e69c2dac 45 std::string sign(const std::string& msg) const override;
8daea594 46
e69c2dac 47 std::string hash(const std::string& msg) const override;
8daea594 48
e69c2dac 49 bool verify(const std::string& msg, const std::string& signature) const override;
8daea594 50
e69c2dac
RG
51 std::string getPublicKeyString() const override;
52 int getBits() const override;
8daea594 53
e69c2dac 54 void fromISCMap(DNSKEYRecordContent& drc, stormap_t& stormap) override;
8daea594 55
d73de874 56 void fromPublicKeyString(const std::string& /* content */) override { throw "Unimplemented"; };
8daea594 57
a2c6e554 58 static std::unique_ptr<DNSCryptoKeyEngine> maker(unsigned int algorithm);
8daea594
AT
59};
60
248d701f 61bool PKCS11ModuleSlotLogin(const std::string& module, const string& tokenId, const std::string& pin);