How to register?
Create self-signed certificate​
To create new certificate you can use tedge cert create
thin-edge.io command:
sudo tedge cert create --device-id alpha
Certificate was successfully created
tedge cert
requires sudo
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 -l /etc/tedge/device-certs/
total 8
-r--r--r-- 1 mosquitto mosquitto 664 May 31 09:26 tedge-certificate.pem
-r-------- 1 mosquitto mosquitto 246 May 31 09:26 tedge-private-key.pem
Errors​
Certificate creation fails due to invalid device id​
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, ' = ( ) , - . ? % * _ ! @]
Certificate already exists in the given location​
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.
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
Certificate was successfully removed
Afterwards, try executing tedge cert create
again.