summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dabInputZmq.cpp47
-rw-r--r--src/dabInputZmq.h13
2 files changed, 59 insertions, 1 deletions
diff --git a/src/dabInputZmq.cpp b/src/dabInputZmq.cpp
index ee38440..956481c 100644
--- a/src/dabInputZmq.cpp
+++ b/src/dabInputZmq.cpp
@@ -145,7 +145,7 @@ void DabInputZmqBase::rebind()
KEY_VALID(m_curve_secret_key) &&
KEY_VALID(m_curve_encoder_key) ) ) ) {
throw std::runtime_error("When enabling encryption, all three "
- "keyfiles must be set!");
+ "keyfiles must be valid!");
}
if (m_config.enable_encryption) {
@@ -495,6 +495,36 @@ void DabInputZmqBase::set_parameter(const string& parameter,
throw ParameterError("Value not understood, specify 0 or 1.");
}
}
+ else if (parameter == "encryption") {
+ if (value == "1") {
+ m_config.enable_encryption = true;
+ }
+ else if (value == "0") {
+ m_config.enable_encryption = false;
+ }
+ else {
+ throw ParameterError("Value not understood, specify 0 or 1.");
+ }
+
+ try {
+ rebind();
+ }
+ catch (std::runtime_error &e) {
+ stringstream ss;
+ ss << "Could not bind socket again with new keys." <<
+ e.what();
+ throw ParameterError(ss.str());
+ }
+ }
+ else if (parameter == "secretkey") {
+ m_config.curve_secret_keyfile = value;
+ }
+ else if (parameter == "publickey") {
+ m_config.curve_public_keyfile = value;
+ }
+ else if (parameter == "encoderkey") {
+ m_config.curve_encoder_keyfile = value;
+ }
else {
stringstream ss;
ss << "Parameter '" << parameter <<
@@ -518,6 +548,21 @@ const string DabInputZmqBase::get_parameter(const string& parameter) const
else
ss << "false";
}
+ else if (parameter == "encryption") {
+ if (m_config.enable_encryption)
+ ss << "true";
+ else
+ ss << "false";
+ }
+ else if (parameter == "secretkey") {
+ ss << m_config.curve_secret_keyfile;
+ }
+ else if (parameter == "publickey") {
+ ss << m_config.curve_public_keyfile;
+ }
+ else if (parameter == "encoderkey") {
+ ss << m_config.curve_encoder_keyfile;
+ }
else {
ss << "Parameter '" << parameter <<
"' is not exported by controllable " << get_rc_name();
diff --git a/src/dabInputZmq.h b/src/dabInputZmq.h
index 871676e..b74b1e8 100644
--- a/src/dabInputZmq.h
+++ b/src/dabInputZmq.h
@@ -142,6 +142,19 @@ class DabInputZmqBase : public DabInputBase, public RemoteControllable {
RC_ADD_PARAMETER(enable,
"If the input is enabled. Set to zero to empty the buffer.");
+ RC_ADD_PARAMETER(encryption,
+ "If encryption is enabled or disabled [1 or 0]."
+ " If 1 is written, the keys are reloaded.");
+
+ RC_ADD_PARAMETER(publickey,
+ "The multiplexer's public key file.");
+
+ RC_ADD_PARAMETER(secretkey,
+ "The multiplexer's secret key file.");
+
+ RC_ADD_PARAMETER(encoderkey,
+ "The encoder's public key file.");
+
/* Set all keys to zero */
INVALIDATE_KEY(m_curve_public_key);
INVALIDATE_KEY(m_curve_secret_key);