File tree Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -857,6 +857,21 @@ DNSCryptoKeyEngine::storvector_t PKCS11DNSCryptoKeyEngine::convertToISCVector()
857
857
return storvect;
858
858
};
859
859
860
+ void PKCS11DNSCryptoKeyEngine::fromISCMap (DNSKEYRecordContent& drc, stormap_t & stormap) {
861
+ drc.d_algorithm = atoi (stormap[" algorithm" ].c_str ());
862
+ d_module = stormap[" engine" ];
863
+ d_slot_id = atoi (stormap[" slot" ].c_str ());
864
+ d_pin = stormap[" pin" ];
865
+ d_label = stormap[" label" ];
866
+ // validate parameters
867
+
868
+ boost::shared_ptr<Pkcs11Token> d_slot;
869
+ d_slot = Pkcs11Token::GetToken (d_module, d_slot_id, d_label);
870
+ if (d_pin != " " && d_slot->LoggedIn () == false )
871
+ if (d_slot->Login (d_pin) == false )
872
+ throw PDNSException (" Could not log in to token (PIN wrong?)" );
873
+ };
874
+
860
875
DNSCryptoKeyEngine* PKCS11DNSCryptoKeyEngine::maker (unsigned int algorithm)
861
876
{
862
877
return new PKCS11DNSCryptoKeyEngine (algorithm);
Original file line number Diff line number Diff line change @@ -33,13 +33,7 @@ class PKCS11DNSCryptoKeyEngine : public DNSCryptoKeyEngine
33
33
std::string getPublicKeyString () const ;
34
34
int getBits () const ;
35
35
36
- void fromISCMap (DNSKEYRecordContent& drc, stormap_t & stormap) {
37
- drc.d_algorithm = atoi (stormap[" algorithm" ].c_str ());
38
- d_module = stormap[" engine" ];
39
- d_slot_id = atoi (stormap[" slot" ].c_str ());
40
- d_pin = stormap[" pin" ];
41
- d_label = stormap[" label" ];
42
- };
36
+ void fromISCMap (DNSKEYRecordContent& drc, stormap_t & stormap);
43
37
44
38
void fromPEMString (DNSKEYRecordContent& drc, const std::string& raw) { throw " Unimplemented" ; };
45
39
void fromPublicKeyString (const std::string& content) { throw " Unimplemented" ; };
You can’t perform that action at this time.
0 commit comments