Skip to content

Commit 5adb80a

Browse files
authored
Merge pull request #432 from anhu/interop_pheonix
Restore instructions for testing against OQS mosquitto integration.
2 parents d6c76be + 1901a83 commit 5adb80a

File tree

2 files changed

+48
-13
lines changed

2 files changed

+48
-13
lines changed

README.md

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -312,27 +312,62 @@ The SN client was tested using the Eclipse Paho MQTT-SN Gateway (https://github.
312312

313313
## Post-Quantum MQTT Support
314314

315-
Recently the OpenQuantumSafe project has integrated their fork of OpenSSL with the mosquito MQTT broker. You can now build wolfMQTT with wolfSSL and liboqs and use that to publish to the mosquito MQTT broker. Currently, wolfMQTT supports the `KYBER_LEVEL1` and `P256_KYBER_LEVEL1` groups and FALCON_LEVEL1 for authentication in TLS 1.3. This works on Linux.
315+
Recently the OpenQuantumSafe project has integrated their fork of OpenSSL with the mosquito MQTT broker. You can now build wolfMQTT with wolfSSL and use that to publish to the mosquito MQTT broker. Currently, wolfMQTT supports the `ML_KEM_768` and `P384_ML_KEM_768` groups and ML-DSA-65 for authentication in TLS 1.3. This works on Linux.
316316

317317
### Getting Started with Post-Quantum Mosquito MQTT Broker and Subscriber
318318

319-
To get started, you can use the code from the following github pull request:
319+
To get started, you can use the oqs-demos repo at https://github.com/open-quantum-safe/oqs-demos/ .
320320

321-
https://github.com/open-quantum-safe/oqs-demos/pull/143
321+
Follow all the instructions in README.md and USAGE.md. This allows you to create a docker image and a docker network. Then you will run a broker, a subscriber and a publisher. At the end the publisher will exit and the broker and subscriber will remain active.
322322

323-
Follow all the instructions in README.md and USAGE.md. This allows you to create a docker image and a docker network. Then you will run a broker, a subscriber and a publisher. At the end the publisher will exit and the broker and subscriber will remain active. You will need to re-activate the publisher docker instance and get the following files onto your local machine:
323+
NOTE: Do not stop the broker and the subscriber instances.
324+
325+
You will need to get into a docker instance and get the following files onto your local machine:
324326

325327
- /test/cert/CA.crt
326328
- /test/cert/publisher.crt
327329
- /test/cert/publisher.key
328330

329-
NOTE: Do not stop the broker and the subscriber instances.
331+
Once the publisher exits, the following command can be executed:
332+
333+
sudo docker run --network mosquitto-test --ip 174.18.0.4 -it --rm --name oqs-mosquitto-publisher -e "BROKER_IP=174.18.0.2" -e "PUB_IP=174.18.0.4" oqs-mosquitto bash
334+
335+
This opens a bash shell "inside" the docker container. You'll see the shell script for executing the publisher. This includes commands for generating the keys and certificates. Execute them and then use cat to display them and then copy and paste them into the wolfMQTT root directory.
336+
337+
### Building and Running Post-Quantum wolfMQTT Publisher
338+
339+
Build and install wolfSSL like this:
340+
341+
```
342+
./autogen.sh (if obtained from github)
343+
./configure --enable-dilithium --enable-mlkem
344+
make all
345+
make check
346+
```
347+
348+
No special flags are required for building wolfMQTT. Simply do the following:
349+
350+
```
351+
./autogen.sh (if obtained from github)
352+
./configure
353+
make all
354+
make check
355+
```
330356

331-
### Building and Running Post-Quantum wolfMQTT Publisher [DEPRECATED]
357+
NOTE: No need to install wolfmqtt.
358+
359+
Since the broker and subscriber are still running, you can use `mqttclient` to publish using post-quantum algorithms in TLS 1.3 by doing the following:
360+
361+
```
362+
./examples/mqttclient/mqttclient -T -h 174.18.0.2 -p 8883 -t -A CA.crt -K publisher.key -c publisher.crt -m "Hello from post-quantum wolfMQTT" -n test/sensor1 -Q P384_ML_KEM_768
363+
```
332364

333-
Please see the following issue on Open Quantum Safe's oqs-demo repo:
365+
Congratulations! You have just published an MQTT message using TLS 1.3 with ML-KEM-768 hybridized with ECDHE on the P-384 curve and ML-DSA-65 signature scheme. To use only ML-KEM-768, replace `P384_ML_KEM_768` with `ML_KEM_768`. Moreover, you have also shown interoperability with liboqs, liboqs-provider, openssl3 and mosquitto.
334366

335-
https://github.com/open-quantum-safe/oqs-demos/issues/346
367+
Latest version combination tested:
368+
- wolfSSL: v5.8.2-stable
369+
- wolfMQTT: v1.20.0
370+
- oqs-demos: commit 29d4dccbd547a62e8ba77d3fef1af5d6f8625d60
336371

337372
## Curl Easy Socket Support
338373

examples/mqttexample.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ int mqtt_parse_args(MQTTCtx* mqttCtx, int argc, char** argv)
417417
#ifdef HAVE_PQC
418418
mTlsPQAlg = myoptarg;
419419
#else
420-
PRINTF("To use '-Q', build wolfSSL with --enable-kyber --enable-dilithium");
420+
PRINTF("To use '-Q', build wolfSSL with --enable-mlkem --enable-dilithium");
421421
#endif
422422
break;
423423
#endif /* !ENABLE_MQTT_CURL */
@@ -726,10 +726,10 @@ int mqtt_tls_cb(MqttClient* client)
726726
#ifdef HAVE_PQC
727727
if ((rc == WOLFSSL_SUCCESS) && (mTlsPQAlg != NULL)) {
728728
int group = 0;
729-
if (XSTRCMP(mTlsPQAlg, "ML_KEM_512") == 0) {
730-
group = WOLFSSL_ML_KEM_512;
731-
} else if (XSTRCMP(mTlsPQAlg, "P256_ML_KEM_512") == 0) {
732-
group = WOLFSSL_P256_ML_KEM_512;
729+
if (XSTRCMP(mTlsPQAlg, "ML_KEM_768") == 0) {
730+
group = WOLFSSL_ML_KEM_768;
731+
} else if (XSTRCMP(mTlsPQAlg, "P384_ML_KEM_768") == 0) {
732+
group = WOLFSSL_P384_ML_KEM_768;
733733
} else {
734734
PRINTF("Invalid post-quantum KEM specified");
735735
}

0 commit comments

Comments
 (0)