libdrmconf 0.13.2
A library to program DMR radios.
Loading...
Searching...
No Matches
encryptionextension.hh
1#ifndef ENCRYPTIONEXTENSION_HH
2#define ENCRYPTIONEXTENSION_HH
3
4#include "configobject.hh"
5
6
10{
12 Q_CLASSINFO("IdPrefix", "key")
13
14
16
19 explicit EncryptionKey(QObject *parent=nullptr);
20
21public:
22 void clear();
23
28
33
38};
39
40
47{
49 Q_CLASSINFO("description", "A basic DMR encryption key.")
50 Q_CLASSINFO("longDescription",
51 "This is a variable sized pre-shared key that can be used to encrypt/decrypt traffic "
52 "on DMR channels. Encryption is forbidden in HAM radio context!")
53
54public:
56 Q_INVOKABLE explicit BasicEncryptionKey(QObject *parent=nullptr);
57
58 ConfigItem *clone() const;
59
60public:
61 YAML::Node serialize(const Context &context, const ErrorStack &err=ErrorStack());
62 bool parse(const YAML::Node &node, Context &ctx, const ErrorStack &err=ErrorStack());
63};
64
65
72{
73 Q_OBJECT
74 Q_CLASSINFO("description", "An enhanced DMR encryption key.")
75 Q_CLASSINFO("longDescription",
76 "This is a 40bit pre-shared RC4 key, that can be used to encrypt/decrypt traffic on "
77 "DMR channels. Encryption is forbidden in HAM radio context!")
78
79public:
81 Q_INVOKABLE explicit ARC4EncryptionKey(QObject *parent=nullptr);
82
83 ConfigItem *clone() const;
84 bool fromHex(const QString &hex, const ErrorStack &err=ErrorStack());
85
86 bool setKey(const QByteArray &key, const ErrorStack &err);
87
88public:
89 YAML::Node serialize(const Context &context, const ErrorStack &err=ErrorStack());
90 bool parse(const YAML::Node &node, Context &ctx, const ErrorStack &err=ErrorStack());
91};
92
93
100{
101 Q_OBJECT
102
103 Q_CLASSINFO("description", "An AES (advanced) DMR encryption key.")
104 Q_CLASSINFO("longDescription",
105 "This is a variable sized (usually 128-256bit) pre-shared key that can be used to "
106 "encrypt/decrypt traffic on DMR channels. Encryption is forbidden in HAM radio "
107 "context!")
108
109public:
111 Q_INVOKABLE explicit AESEncryptionKey(QObject *parent=nullptr);
112
113 ConfigItem *clone() const;
114
115 bool setKey(const QByteArray &key, const ErrorStack &err);
116
117public:
118 YAML::Node serialize(const Context &context, const ErrorStack &err=ErrorStack());
119 bool parse(const YAML::Node &node, Context &ctx, const ErrorStack &err=ErrorStack());
120};
121
123
124
125
133{
135
136public:
138 explicit EncryptionKeys(QObject *parent=nullptr);
139
140 int add(ConfigObject *obj, int row=-1, bool unique=true);
141
143 EncryptionKey *key(int index) const;
144
146};
147
148
149
150#endif // ENCRYPTIONEXTENSION_HH
Represents a variable size AES (enhanced) encryption key.
Definition encryptionextension.hh:100
Represents an (enhanced) ARC4 encryption key.
Definition encryptionextension.hh:72
Represents a DMR (basic) encryption key.
Definition encryptionextension.hh:47
Parse context for config objects.
Definition configobject.hh:43
Base class for all configuration objects (channels, zones, contacts, etc).
Definition configobject.hh:35
virtual ConfigItem * clone() const =0
Clones this item.
virtual ConfigItem * allocateChild(QMetaProperty &prop, const YAML::Node &node, const Context &ctx, const ErrorStack &err=ErrorStack())
Allocates an instance for the given property on the given YAML node.
Definition configobject.cc:487
virtual YAML::Node serialize(const Context &context, const ErrorStack &err=ErrorStack())
Recursively serializes the configuration to YAML nodes.
Definition configobject.cc:365
const Object * as() const
Casts this object to the given type.
Definition configobject.hh:148
List class for config objects.
Definition configobject.hh:344
Base class of all labeled and named objects.
Definition configobject.hh:194
bool parse(const YAML::Node &node, Context &ctx, const ErrorStack &err=ErrorStack())
Parses the given YAML node, updates the given object and updates the given context (IDs).
Definition configobject.cc:1068
Base class of all encryption keys.
Definition encryptionextension.hh:10
QString key
The key representation as a hex string.
Definition encryptionextension.hh:15
void clear()
Clears the config object.
Definition encryptionextension.cc:15
virtual bool setKey(const QByteArray &key, const ErrorStack &err=ErrorStack())
Sets the binary key.
Definition encryptionextension.cc:35
virtual QString toHex() const
Converts a key to a hex string.
Definition encryptionextension.cc:25
QByteArray _key
Holds the key data.
Definition encryptionextension.hh:37
virtual bool fromHex(const QString &hex, const ErrorStack &err=ErrorStack())
Creates a key from the given hex-string.
Definition encryptionextension.cc:20
The list of encryption keys.
Definition encryptionextension.hh:133
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition errorstack.hh:43