To create new certificate you can use tedge cert create
thin-edge.io command:
sudo tedge cert create --device-id alpha
Note:
tedge cert
requiressudo
privilege. This command provides no output on success.
sudo tedge cert create
will create certificate in a default location (/etc/tedge/device-certs/
).
To use a custom location, refer to tedge config
.
Now you should have a certificate in the /etc/tedge/device-certs/
directory.
$ ls /etc/tedge/device-certs/
/etc/tedge/device-certs/tedge-certificate.pem
If non-supported characters are used for the device id then the cert create will fail with below error:
Error: failed to create a test certificate for the device +.
Caused by:
0: DeviceID Error
1: The string '"+"' contains characters which cannot be used in a name [use only A-Z, a-z, 0-9, ' = ( ) , - . ? % * _ ! @]
If the certificate already exists you may see following error:
Error: failed to create a test certificate for the device alpha.
Caused by:
A certificate already exists and would be overwritten.
Existing file: "/etc/tedge/device-certs/tedge-certificate.pem"
Run `tedge cert remove` first to generate a new certificate.
Warning! Removing a certificate can break the bridge and more seriously delete a certificate that was a CA-signed certificate.
Follow the instruction to remove the existing certificate and issue tedge cert remove
:
sudo tedge cert remove
and try tedge cert create
once again.