Skip to content

parsec-cli-tests.sh incorrectly fails with openssl 3.0.5 #90

@anta5010

Description

@anta5010

The test_rsa_key_bits() function in parsec-cli-tests.sh greps openssl output for RSA Public-Key:: https://github.com/parallaxsecond/parsec-tool/blob/main/tests/parsec-cli-tests.sh#L234

But, openssl 3.0.5 doesn't include RSA in the output:

Public-Key: (1024 bit)
Modulus:
    00:b8:0d:17:75:56:ce:52:57:cd:8a:55:28:d6:b8:
    6c:a2:95:db:86:58:f7:cc:6e:fb:f5:e3:31:ea:e3:
    8b:48:0c:15:24:ac:78:41:99:6e:12:ce:6a:05:18:
    9d:fc:52:8a:51:82:97:83:e0:a6:39:ca:eb:06:07:
    89:01:6a:0a:1b:83:d6:fd:4b:3d:48:91:de:9a:41:
    f8:09:6c:68:0a:5c:fb:85:f2:16:51:8b:2a:0d:ea:
    6d:8d:8b:c5:38:f6:b3:9d:22:49:55:c6:01:0c:3b:
    b3:20:eb:d6:af:46:14:8a:0e:ea:a2:3d:27:1a:b8:
    e9:f3:33:c6:cd:7e:e1:ec:e7
Exponent: 65537 (0x10001)

As a result we see parsec-cli-tests.sh fails, for example, in Yocto built images:

[INFO ] Creating RSA encryption key...
[INFO ] Key "anta-key-rsa-bits" created.
Error: create-rsa-key should have produced a 2048-bit RSA key.

[INFO ] Creating RSA encryption key...
[INFO ] Key "anta-key-rsa-bits" created.
Error: create-rsa-key should have produced a 1024-bit RSA key.

A fix would be very simple:

diff --git a/tests/parsec-cli-tests.sh b/tests/parsec-cli-tests.sh
index 2a56fb2..78e5434 100755
--- a/tests/parsec-cli-tests.sh
+++ b/tests/parsec-cli-tests.sh
@@ -231,7 +231,7 @@ test_rsa_key_bits() {

     run_cmd $PARSEC_TOOL_CMD create-rsa-key --key-name $KEY $key_param
     run_cmd $PARSEC_TOOL_CMD export-public-key --key-name $KEY >${MY_TMP}/checksize-${KEY}.pem
-    if ! run_cmd $OPENSSL rsa -pubin -text -noout -in ${MY_TMP}/checksize-${KEY}.pem | grep -q "RSA Public-Key: (${key_size} bit)"; then
+    if ! run_cmd $OPENSSL rsa -pubin -text -noout -in ${MY_TMP}/checksize-${KEY}.pem | grep -q "Public-Key: (${key_size} bit)"; then
        echo "Error: create-rsa-key should have produced a ${key_size}-bit RSA key."
        EXIT_CODE=$(($EXIT_CODE+1))
     fi

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions