mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[mqtt] Fix certificate pinning (#16857)
Signed-off-by: Jan N. Klug <github@klug.nrw> Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
parent
0fbe6f7ca1
commit
34107ec230
@ -83,6 +83,12 @@ public class BrokerHandler extends AbstractBrokerHandler implements PinnedCallba
|
||||
logger.error("Received pins hash is empty!");
|
||||
return;
|
||||
}
|
||||
PinMessageDigest hashDigest = pin.getHashDigest();
|
||||
if (hashDigest == null) {
|
||||
logger.error("Received pins message digest is not set!");
|
||||
return;
|
||||
}
|
||||
|
||||
String configKey = null;
|
||||
try {
|
||||
switch (pin.getType()) {
|
||||
@ -99,7 +105,7 @@ public class BrokerHandler extends AbstractBrokerHandler implements PinnedCallba
|
||||
}
|
||||
|
||||
Configuration thingConfig = editConfiguration();
|
||||
thingConfig.put(configKey, HexUtils.bytesToHex(hash));
|
||||
thingConfig.put(configKey, hashDigest.getMethod() + ":" + HexUtils.bytesToHex(hash));
|
||||
updateConfiguration(thingConfig);
|
||||
}
|
||||
|
||||
|
@ -54,6 +54,10 @@ public class Pin {
|
||||
return pinData;
|
||||
}
|
||||
|
||||
public @Nullable PinMessageDigest getHashDigest() {
|
||||
return hashDigest;
|
||||
}
|
||||
|
||||
public void setLearningMode() {
|
||||
this.learning = true;
|
||||
this.pinData = null;
|
||||
|
Loading…
Reference in New Issue
Block a user