LibLogicalAccess  2.5.0
An Open Source RFID Library
Loading...
Searching...
No Matches
PKCSkeystorage.hpp
Go to the documentation of this file.
1#pragma once
2
5
6namespace logicalaccess
7{
11class LLA_CORE_API PKCSKeyStorage : public KeyStorage
12{
13 public:
14 KeyStorageType getType() const override
15 {
16 return KST_PKCS;
17 }
18
19 std::string getDefaultXmlNodeName() const override
20 {
21 return "PKCSStorage";
22 }
23
24 void serialize(boost::property_tree::ptree &parentNode) override;
25
26 void unSerialize(boost::property_tree::ptree &node) override;
27
28 const ByteVector &get_key_id() const
29 {
30 return pkcs_object_id_;
31 }
32
33 void set_key_id(const ByteVector &keyid)
34 {
35 pkcs_object_id_ = keyid;
36 }
37
38 size_t get_slot_id() const
39 {
40 return slot_id_;
41 }
42
43 void set_slot_id(size_t slot_id)
44 {
45 slot_id_ = slot_id;
46 }
47
48 const std::string &get_pkcs_session_password() const
49 {
50 return pkcs_session_password_;
51 }
52
53 void set_pkcs_session_password(const std::string &pwd)
54 {
55 pkcs_session_password_ = pwd;
56 }
57
58 const std::string &get_proteccio_conf_dir() const
59 {
60 return env_PROTECCIO_CONF_DIR_;
61 }
62
63 void set_proteccio_conf_dir(const std::string &d)
64 {
65 env_PROTECCIO_CONF_DIR_ = d;
66 }
67
68 const std::string &get_pkcs_shared_object_path() const
69 {
70 return pkcs_library_shared_object_path_;
71 }
72
73 void set_pkcs_shared_object_path(const std::string &d)
74 {
75 pkcs_library_shared_object_path_ = d;
76 }
77
78 private:
84
85 // Password to log into the PKCS session.
86 // This might be serialized in cleartext, which is bad.
87 // Changing that will need LLA refactoring.
89
90 /*
91 * PKCS Token slot id.
92 */
93 size_t slot_id_ = 0;
94
95 // The following value should not lives in the KeyStorage object.
96 // But until we can refactor the cryptographic API of LLA, this will
97 // have to do.
98
99 // cppkcs will ignore the value of env_PROTECCIO_CONF_DIR_ and
100 // pkcs_library_shared_object_path_ if the underlying was already
101 // loaded. env_PROTECCIO_CONF_DIR_ is also ignored if the environment
102 // variable is already set.
103
104 // The value that we will set to the PROTECCIO_CONF_DIR
105 // environment variable. This is needed by the atosnethsm PKCS
106 // library implementation.
108
109 // Path to the PKCS shared object that the cppkcs library will use.
111};
112}
A Key storage base class. The key storage specify where the key is stored in memory....
Definition: keystorage.hpp:31
Definition: PKCSkeystorage.hpp:12
const std::string & get_pkcs_shared_object_path() const
Definition: PKCSkeystorage.hpp:68
void set_proteccio_conf_dir(const std::string &d)
Definition: PKCSkeystorage.hpp:63
const ByteVector & get_key_id() const
Definition: PKCSkeystorage.hpp:28
std::string getDefaultXmlNodeName() const override
Get the default Xml Node name for this object.
Definition: PKCSkeystorage.hpp:19
std::string env_PROTECCIO_CONF_DIR_
Definition: PKCSkeystorage.hpp:107
void set_pkcs_shared_object_path(const std::string &d)
Definition: PKCSkeystorage.hpp:73
const std::string & get_proteccio_conf_dir() const
Definition: PKCSkeystorage.hpp:58
void set_key_id(const ByteVector &keyid)
Definition: PKCSkeystorage.hpp:33
ByteVector pkcs_object_id_
Definition: PKCSkeystorage.hpp:83
void set_slot_id(size_t slot_id)
Definition: PKCSkeystorage.hpp:43
void set_pkcs_session_password(const std::string &pwd)
Definition: PKCSkeystorage.hpp:53
const std::string & get_pkcs_session_password() const
Definition: PKCSkeystorage.hpp:48
std::string pkcs_session_password_
Definition: PKCSkeystorage.hpp:88
size_t get_slot_id() const
Definition: PKCSkeystorage.hpp:38
KeyStorageType getType() const override
Get the key storage type.
Definition: PKCSkeystorage.hpp:14
std::string pkcs_library_shared_object_path_
Definition: PKCSkeystorage.hpp:110
Key storage description.
std::vector< uint8_t > ByteVector
Definition: lla_fwd.hpp:80
Definition: asn1.hpp:9
KeyStorageType
The key storage types.
Definition: keystorage.hpp:17
@ KST_PKCS
Definition: keystorage.hpp:22