-
|
I know I can manually generate a server key pair (private and public) using: /usr/bin/rustdesk-utils genkeypairor, using Docker: docker run --rm --entrypoint /usr/bin/rustdesk-utils rustdesk/rustdesk-server-s6:latest genkeypairBut is it possible to generate one using ssh-keygen -t ed25519 -C "rustdeskserver_key" -N "" -m pem -f "rustdeskserver_key_filepath"This would allow an easier server provisioning/configuration. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
|
rustdesk uses this function to generate an ed25519 keypair. Lines 27 to 33 in 4240c47 I don't know a way for openssl to handle keys generated by ssh-keygen. If you need some automation, you can always propose a PR to handle the output of |
Beta Was this translation helpful? Give feedback.
-
|
I wondered about the keys too and how you could create them. I think the important information that is missing here is, that the private key actually contains the public key. $ rustdesk-utils genkeypair
Public Key: Haa33UK321Q8P2JEdfAp7JfEzXMYfL82iUzmLq9hA3c=
Secret Key: cuHdOxnASB0BbrsVYel9KVS6v29OqT6zhINJdTb1kOsdprfdQrfbVDw/YkR18Cnsl8TNcxh8vzaJTOYur2EDdw==from base64 import b64decode
priv = b64decode("cuHdOxnASB0BbrsVYel9KVS6v29OqT6zhINJdTb1kOsdprfdQrfbVDw/YkR18Cnsl8TNcxh8vzaJTOYur2EDdw==")
pub = b64decode("Haa33UK321Q8P2JEdfAp7JfEzXMYfL82iUzmLq9hA3c=")
priv.endswith(pub) # gives TrueIn the format that is used by Sodium, the first 32 byte are the actual private key, while the second 32 byte are just a copy of the public key. Not sure if you can use openssl for that now, but the information is basically there: $ openssl genpkey -algorithm ed25519 -text -out -
-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VwBCIEIPzjVH5z6h5GX3fv0IyxydJTrIcX3gykYomlchFPfT6b
-----END PRIVATE KEY-----
ED25519 Private-Key:
priv:
fc:e3:54:7e:73:ea:1e:46:5f:77:ef:d0:8c:b1:c9:
d2:53:ac:87:17:de:0c:a4:62:89:a5:72:11:4f:7d:
3e:9b
pub:
d5:c3:01:e5:2f:df:53:09:5a:93:69:db:d3:9c:52:
7c:bb:d3:b9:de:c4:18:7f:e5:1e:c9:87:72:0a:50:
8e:44 So here is my unpolished PoC code: #!/bin/bash
KEY=$(openssl genpkey -algorithm ed25519 -text -out -)
PRIV=$(sed -n '/^priv:/,/^pub:/p' <<< "$KEY" | sed '1d;$d' | tr -d ':\n ')
PUB=$(sed -n '/^pub:/,$p' <<< "$KEY" | sed '1d' | tr -d ':\n ')
PRIVATEB64=$(echo $PRIV$PUB | xxd -r -p | base64 -w 0)
PUBLICB64=$(echo $PUB | xxd -r -p | base64 -w 0)
echo "Public Key: $PUBLICB64"
echo "Secret Key: $PRIVATEB64"Demo: $ gen_keys.sh
Public Key: QTEN1NKtEB2BYtQhDumMB5mXDgsa9u8TAlBkjHIPdEE=
Secret Key: QDt1VBcIogzi7ojjZ5nWejpsFvDcOW9ZCv7KiqI9qrNBMQ3U0q0QHYFi1CEO6YwHmZcOCxr27xMCUGSMcg90QQ==
$ rustdesk-utils validatekeypair QTEN1NKtEB2BYtQhDumMB5mXDgsa9u8TAlBkjHIPdEE= QDt1VBcIogzi7ojjZ5nWejpsFvDcOW9ZCv7KiqI9qrNBMQ3U0q0QHYFi1CEO6YwHmZcOCxr27xMCUGSMcg90QQ==
Key pair is VALID |
Beta Was this translation helpful? Give feedback.
I wondered about the keys too and how you could create them. I think the important information that is missing here is, that the private key actually contains the public key.
For example:
In the format that …