@@ -52,6 +52,39 @@ Generate CSR without an existing certificate and private key
52
52
... openssl req -in /etc/tedge/device-certs/tedge.csr -pubkey -noout | openssl md5
53
53
Should Be Equal ${output_private_key_md5 } ${output_csr_md5 }
54
54
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/tedge@second-certificate.pem
62
+ Execute Command
63
+ ... tedge config set c8y.device.key_path --profile second /etc/tedge/device-certs/tedge@second-key.pem
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/tedge@second-certificate.pem
67
+ ${hash_before_private_key } = Execute Command md5sum /etc/tedge/device-certs/tedge@second-key.pem
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/tedge@second-certificate.pem
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/tedge@second-key.pem -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/tedge@second-certificate.pem
84
+ ${hash_after_private_key } = Execute Command md5sum /etc/tedge/device-certs/tedge@second-key.pem
85
+ Should Be Equal ${hash_before_cert } ${hash_after_cert }
86
+ Should Be Equal ${hash_before_private_key } ${hash_after_private_key }
87
+
55
88
56
89
*** Keywords ***
57
90
Setup With Self-Signed Certificate
0 commit comments