LibLogicalAccess  2.5.0
An Open Source RFID Library
Loading...
Searching...
No Matches
keystorage.hpp
Go to the documentation of this file.
1
7#ifndef LOGICALACCESS_KEYSTORAGE_HPP
8#define LOGICALACCESS_KEYSTORAGE_HPP
9
11
12namespace logicalaccess
13{
17typedef enum {
18 KST_COMPUTER_MEMORY = 0x00, /* Key stored in computer memory */
19 KST_READER_MEMORY = 0x01, /* Key stored in reader memory */
20 KST_SAM = 0x02, /* Key stored in SAM */
21 KST_SERVER = 0x03, /* Key store in IKS */
22 KST_PKCS = 0x04 /* Key store in PKCS token */
24
29class LLA_CORE_API KeyStorage : public XmlSerializable,
30 public std::enable_shared_from_this<KeyStorage>
31{
32 public:
33 using XmlSerializable::serialize;
34 using XmlSerializable::unSerialize;
35
36 virtual ~KeyStorage() = default;
37
42 virtual KeyStorageType getType() const = 0;
43
48 static std::shared_ptr<KeyStorage> getKeyStorageFromType(KeyStorageType kst);
49
50 void serialize(boost::property_tree::ptree &parentNode) override;
51
52 void unSerialize(boost::property_tree::ptree &node) override;
53
57 std::string getMetadata(const std::string &key);
58
63 bool hasMetadata(const std::string &key) const;
64
68 void addMetadata(const std::string &key, const std::string &value);
69
70 protected:
71 std::map<std::string, std::string> metadata_;
72};
73}
74
75#endif /* LOGICALACCESS_KEYSTORAGE_HPP */
A Key storage base class. The key storage specify where the key is stored in memory....
Definition: keystorage.hpp:31
virtual KeyStorageType getType() const =0
Get the key storage type.
std::map< std::string, std::string > metadata_
Definition: keystorage.hpp:71
virtual ~KeyStorage()=default
A Xml Serializable base class. Add Xml serialization to a class.
Definition: xmlserializable.hpp:54
Definition: asn1.hpp:9
KeyStorageType
The key storage types.
Definition: keystorage.hpp:17
@ KST_PKCS
Definition: keystorage.hpp:22
@ KST_READER_MEMORY
Definition: keystorage.hpp:19
@ KST_SERVER
Definition: keystorage.hpp:21
@ KST_SAM
Definition: keystorage.hpp:20
@ KST_COMPUTER_MEMORY
Definition: keystorage.hpp:18
Reader provider.