@@ -52,6 +52,39 @@ Generate CSR without an existing certificate and private key
5252 ... openssl req -in /etc/tedge/device-certs/tedge.csr -pubkey -noout | openssl md5
5353 Should Be Equal ${output_private_key_md5 } ${output_csr_md5 }
5454
55+ Generate CSR using the device-id from an existing certificate and private key of cloud profile
56+ [Tags] \#3315
57+ [Setup] Setup With Self-Signed Certificate
58+
59+ ${second_device_sn } = Catenate SEPARATOR=_ ${DEVICE_SN } second
60+ Execute Command
61+ ... tedge config set c8y.device.cert_path --profile second /etc/tedge/device-certs/
[email protected] 62+ Execute Command
63+ ... tedge config set c8y.device.key_path --profile second /etc/tedge/device-certs/
[email protected] 64+ Execute Command tedge cert create --device-id ${second_device_sn } c8y --profile second
65+
66+ ${hash_before_cert } = Execute Command md5sum /etc/tedge/device-certs/
[email protected] 67+ ${hash_before_private_key } = Execute Command md5sum /etc/tedge/device-certs/
[email protected] 68+
69+ Execute Command sudo tedge cert create-csr c8y --profile second
70+
71+ ${output_cert_subject } = Execute Command
72+ ... openssl x509 -noout -subject -in /etc/tedge/device-certs/
[email protected] 73+ ${output_csr_subject } = Execute Command
74+ ... openssl req -noout -subject -in /etc/tedge/device-certs/tedge.csr
75+ Should Be Equal ${output_cert_subject } ${output_csr_subject }
76+
77+ ${output_private_key_md5 } = Execute Command
78+ ... openssl pkey -in /etc/tedge/device-certs/
[email protected] -pubout | openssl md5
79+ ${output_csr_md5 } = Execute Command
80+ ... openssl req -in /etc/tedge/device-certs/tedge.csr -pubkey -noout | openssl md5
81+ Should Be Equal ${output_private_key_md5 } ${output_csr_md5 }
82+
83+ ${hash_after_cert } = Execute Command md5sum /etc/tedge/device-certs/
[email protected] 84+ ${hash_after_private_key } = Execute Command md5sum /etc/tedge/device-certs/
[email protected] 85+ Should Be Equal ${hash_before_cert } ${hash_after_cert }
86+ Should Be Equal ${hash_before_private_key } ${hash_after_private_key }
87+
5588
5689*** Keywords ***
5790Setup With Self-Signed Certificate
0 commit comments