Skip to content

Commit 079c229

Browse files
timballhubwriter
andauthored
use ed25519 keys instead of rsa keys (#362)
* use ed25519 keys instead of rsa keys RSA keys are outdated. Even by using larger 4096 keys maybe it's best to move away from rsa keys altogether. This PR updates the document to suggest using ed25519 keys which, at this time, defaults to a 16 round key deviation function. It may be useful to suggest more rounds for the KDF but that's for a different PR. --timball * Add RSA fallback and change id_rsa to id_ed25519 Co-authored-by: hubwriter <[email protected]> Co-authored-by: hubwriter <[email protected]>
1 parent 354d8c2 commit 079c229

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

content/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,34 +20,42 @@ If you don't want to reenter your passphrase every time you use your SSH key, yo
2020
{% data reusables.command_line.open_the_multi_os_terminal %}
2121
2. Paste the text below, substituting in your {% data variables.product.product_name %} email address.
2222
```shell
23-
$ ssh-keygen -t rsa -b 4096 -C "<em>[email protected]</em>"
23+
$ ssh-keygen -t ed25519 -C "<em>[email protected]</em>"
2424
```
25+
{% note %}
26+
27+
**Note:** If you are using a legacy system that doesn't support the Ed25519 algorithm, use:
28+
```shell
29+
$ ssh-keygen -t rsa -b 4096 -C "[email protected]"
30+
```
31+
32+
{% endnote %}
2533
This creates a new ssh key, using the provided email as a label.
2634
```shell
27-
> Generating public/private rsa key pair.
35+
> Generating public/private ed25519 key pair.
2836
```
2937
3. When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location.
3038

3139
{% mac %}
3240

3341
```shell
34-
> Enter a file in which to save the key (/Users/<em>you</em>/.ssh/id_rsa): <em>[Press enter]</em>
42+
> Enter a file in which to save the key (/Users/<em>you</em>/.ssh/id_ed25519): <em>[Press enter]</em>
3543
```
3644

3745
{% endmac %}
3846

3947
{% windows %}
4048

4149
```shell
42-
> Enter a file in which to save the key (/c/Users/<em>you</em>/.ssh/id_rsa):<em>[Press enter]</em>
50+
> Enter a file in which to save the key (/c/Users/<em>you</em>/.ssh/id_ed25519):<em>[Press enter]</em>
4351
```
4452

4553
{% endwindows %}
4654

4755
{% linux %}
4856

4957
```shell
50-
> Enter a file in which to save the key (/home/<em>you</em>/.ssh/id_rsa): <em>[Press enter]</em>
58+
> Enter a file in which to save the key (/home/<em>you</em>/.ssh/id_ed25519): <em>[Press enter]</em>
5159
```
5260

5361
{% endlinux %}
@@ -81,18 +89,18 @@ Before adding a new SSH key to the ssh-agent to manage your keys, you should hav
8189
$ touch ~/.ssh/config
8290
```
8391
84-
* Open your `~/.ssh/config` file, then modify the file, replacing ` ~/.ssh/id_rsa` if you are not using the default location and name for your `id_rsa` key.
92+
* Open your `~/.ssh/config` file, then modify the file, replacing ` ~/.ssh/id_ed25519` if you are not using the default location and name for your `id_ed25519` key.
8593
8694
```
8795
Host *
8896
AddKeysToAgent yes
8997
UseKeychain yes
90-
IdentityFile ~/.ssh/id_rsa
98+
IdentityFile ~/.ssh/id_ed25519
9199
```
92100
93101
3. Add your SSH private key to the ssh-agent and store your passphrase in the keychain. {% data reusables.ssh.add-ssh-key-to-ssh-agent %}
94102
```shell
95-
$ ssh-add -K ~/.ssh/id_rsa
103+
$ ssh-add -K ~/.ssh/id_ed25519
96104
```
97105
{% note %}
98106

0 commit comments

Comments
 (0)