Ошибка key is invalid you must supply a key in openssh public key format

However when I try to add my new SSH key I get the following error: “key is invalid. you must supply a key in openssh public key format.”

Hi @csperando, welcome to the community
The email at the end of your key is ok as comments are supported for that key type.
All ssh-ed25519 keys will always be 80 (68 removing the ssh-ed25519) characters in length (do not worry about the comment/email at the end).
Anyway on checking you keylength it has an extra 7 characters, which would explain the error message related to an unrecognised key format.

Could you try deleting and regenerating your key, and we can debug from there it f does not work.
ssh-keygen -t ed25519 -C "your_email@example.com"
Then try adding your SSH ‘Public’ Key part to your GitHub account (e.g. id_ed25519.pub, or replacing id_ed25519 in the command with the name of your private key file you used)

If you are still not working/the key length is incorrect, can you provide some more details on steps to reproduce, such as environment OS, are you using Git and what version, are you using Git Bash or Git CMD?

When you create ssh keys you get 2 key’s.

One is the public key with «*.pub» and one private key.

You can read both keys if you open the files.

The private key begins with something like:
—-BEGIN OPENSSH PRIVATE KEY——

The public key starts with the Digital Signature Algorithm
it is a one row string

You have to copy the «*.pub» to the git server or on other servers if you work with ssh.

Never give away your private key and use always a password with your keys if someone copy or steal the private key.

answered Jun 26, 2022 at 10:05

Blockchain Office's user avatar

I just had the same issue!

At the end of the day, I was trying to paste the wrong key; make sure you open the ~/.ssh/id_rsa.pub file, not only ~/.ssh/id_rsa

answered Mar 14 at 12:19

Vitor Avancini's user avatar

1

The error is usually one of the following:

  • Copy from id_rsa, id_rsa.pub in some scenarios, open it directly and it will be misformatted
  • Make sure you are pasting the public key id_rsa.pub or the private key id_rsa; and that you are copying all of the text
  • in the top right corner of your GitHub account, or Setting in the Blog repository.
  • Paste the wrong page, Secrets or Deploy keys; the former is common for deploying Hexo Blog, the latter is common for push

Solutions:

clip < ~/.ssh/id_rsa.pub      # Copy directly to clipboard
cat ~/.ssh/id_rsa.pub         # Copy after exporting to the terminal
Open with notepad, notepad++  # and copy and paste

answered Sep 1, 2022 at 16:31

XMuli's user avatar

XMuliXMuli

114 bronze badges

The tutorial I was following told me to generate a DSA key when it should have been telling me to generate a RSA key! Guess the tutorial was a little dated maybe. The rest of it seemed to work okay. Hope that helps someone. Luck.

answered Dec 19, 2022 at 13:40

Clarius's user avatar

ClariusClarius

1,16310 silver badges9 bronze badges

Andrey Bogatyrev

Проблема с добавлением SSH ключа на GitHub.
Генерировал уже не один ключ.

Пытаюсь понять в чем проблема использую GitHub Docs:

# Ensure the ssh-agent is running.
$ eval "$(ssh-agent -s)"
Agent pid 1276

# Add your SSH private key to the ssh-agent.
$ ssh-add ~/.ssh/id_ed25519
Identity added: /c/Users/M72e-2/.ssh/id_ed25519 (2way@yandex.ru)

# Копирую ключ из Git Bush (либо из сохраненного файла в текстовом редакторе)
$ clip < ~/.ssh/id_ed25519.pub

# Пытаюсь добавить ключ в GitHub (с почтой и без)
SHA256:NAVXvX3fI7CGSl+9UScomAQ1CbyPnBes5vRAd2Q1Ho4 2way@yandex.ru , но всегда выдает ошибку:
"Key is invalid. You must supply a key in OpenSSH public key format".

# ключ существует
$ ls -al ~/.ssh
total 23
drwxr-xr-x 1 M72e-2 197121   0 Aug 20 23:48 ./
drwxr-xr-x 1 M72e-2 197121   0 Aug 20 23:34 ../
-rw-r--r-- 1 M72e-2 197121 464 Aug 21 02:53 id_ed25519
-rw-r--r-- 1 M72e-2 197121  97 Aug 21 02:53 id_ed25519.pub
-rw-r--r-- 1 M72e-2 197121  92 Aug 20 23:48 known_hosts

В чем проблема?


4


0

Aleksandr Litvinov

Ключ, который нужно вставить в github должен начинаться с «ssh-ed25519». Если вы открываете публичный ключ и видите там строку с «SHA256» вначале, то возможно вы как-то не так сгенерировали ключ. Правильная команда:

ssh-keygen -t ed25519 -C "your_email@example.com"


0

Елизавета Пантюхина

Aleksandr Litvinov, у меня такая же проблема. Ключ начинается с SHA256, но команду я ввела правильно, перепроверила и повторно вводила. Ссылка со скриншотом команды https://ibb.co/QMM4Ld6


0

Andrey Bogatyrev

`**Aleksandr Litvinov**, 
# Все получилось.

# После команды: 
$ ssh-keygen -t ed25519 -C "2way@yandex.ru"

# Получаю такое сообщение:
Generating public/private ed25519 key pair.
Enter file in which to save the key (/c/Users/M72e-2/.ssh/id_ed25519):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/M72e-2/.ssh/id_ed25519
Your public key has been saved in /c/Users/M72e-2/.ssh/id_ed25519.pub
The key fingerprint is:
SHA256:tSbaOFigLSfQuzFpSoX9bZdM6UTmV8OZHxlzOHO5oU0 2way@yandex.ru

# Изначально для GitHub добавлял этот ключ - "SHA256:......", 
# но это приводило к ошибке "Key is invalid. ..."

# Ключ нужен именно из файла /id_ed25519.pub, 
# причем смог его скопировать только именно из Bash:
$ cd  /c/Users/M72e-2/.ssh
$ cat id_ed25519.pub
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIODl7HLIHn++hPLdUwLT7TbTjraz/cOw+MmpCvxo6Wpg 2way@yandex.ru`

# SHA256:... - это приватный ключ?


1

Aleksandr Litvinov

Abo, здорово, что получилось!

Елизавета, вам нужно получить содержимое сгенерированного файла, а не то, что выводится после выполнения команды.

То, что вы видите в выводе создания ключа — это отпечаток открытого ключа, а не сам ключ.


0

when i tried generating SSH key by following the steps given in the github documentation page after the first command it has asked to run

$ ssh-keygen -t ed25519 -C "your_email@example.com"

this gives me the key and asks to enter pass phrase when i copy the key and paste into github > settings > SSH keys > new ssh key it shows me this error

Key is invalid. You must supply a key in OpenSSH public key format

so how do i fix this ?

Edit : i was watching this tutorial on how to upload projects on git i followed the exact tutorial unitl 20:28 where the tutor goes to the git hub page and copy pastes the command in the terminal after all previous commands it works for him but dosent work for me . im new to linux ubuntu so i dont know the difficult terms this is the most i can i explain

Solved: i was pasting the wrong thing in the github > settings > SSH keys > new ssh key the correct thing i have to paste was the code written in the file mentioned in the output something like

~/.ssh/id_ed25519.pub

this file will be in /home/.ssh there might be multiple files check the exact file which is mentioned in the output of the terminal open that file and paste the content in the file in github > settings > SSH keys > new ssh key and this time it should not show any error

asked Apr 3 at 15:14

VirajS's user avatar

9

i was pasting the wrong thing in the github > settings > SSH keys > new ssh key the correct thing i have to paste was the code written in the file mentioned in the output something like

~/.ssh/id_ed25519.pub

this file will be in /home/.ssh there might be multiple files check the exact file which is mentioned in the output of the terminal open that file and paste the content in the file in github > settings > SSH keys > new ssh key and this time it should not show any error

answered Apr 4 at 7:16

VirajS's user avatar

Note: It seems that $LaTeX$ rendering is very broken, either for my Firefox browser or for the site. Here is an example: $mathfrak{a}_{n} = mathfrak{a}_{n + 1} = cdots$ turns into $mathfrak{a}_{n} = mathfrak{a}_{n + 1} = cdots$. I can’t fix it, so I have rendered it and pasted an image below. Hopefully it will be fixed soon. (I might make a meta post, not sure if that’s the right move).

Update: It seems to be fixed when I submitted the question? It rendered as broken LaTeX (and very slowly, unlike now where it’s instant). I have moved the image to the bottom, in case the problem is occuring for others.


Hi! I am reading Cox’s “Primes of the Form $x^2 + ny^2$“, and am on Chapter 5 (it’s a speedrun from number fields to Hilbert’s class field). I am attempting exercise 5.1, and I have done some parts, so I am both asking for verification for my solution as well as hints for the rest.

Things we have stated:

Proposition 5.3. For a number field $K$

(i) $mathcal{O}_K$ is a subring of $mathbb{C}$ whose field of fractions is $K$.

(ii) $mathcal{O}_K$ is a free $mathbb{Z}$-module of rank $[K : mathbb{Q}]$.


(a) Show that a nonzero ideal $mathfrak{a}$ of $mathcal{O}_K$ contains a nonzero integer $m$. (Hint: …)

My solution: Let $alpha neq 0$ be in $mathfrak{a}$. Of course it is algebraic, so let the monic integer polynomial $f(x) = a_0 + a_1x + cdots + a_{n – 1}x^{n – 1} + x^n$ be its minimal polynomial. Now, $langle alpha rangle subset mathfrak{a}$. In particular, for all integers $i geq 1$, the elements $alpha^i$ are in $mathfrak{a}$. This then means $sum_{i geq 1} a_i alpha^i in mathfrak{a}$, and since $f(alpha) = 0 in mathfrak{a}$, we have $m = a_0 in mathfrak{a}$.


(b) Show that $mathcal{O}_K / mathfrak{a}$ is finite whenever $mathfrak{a}$ is a nonzero ideal of $mathcal{O}_K$. Hint: if $m$ is the integer from (a), consider the surjection $mathcal{O}_K / mmathcal{O}_K to mathcal{O}_K / mathfrak{a}$. Use part (ii) of Proposition 5.3 to compute the order of $mathcal{O}_K / mmathcal{O}_K$.

My Ideas: From above, we know that $langle m rangle subset langle alpha rangle subset mathfrak{a}$, so my intuition tells me that this surjection definitely exists. (In my intuition, everything’s a module / vector space, so this surjection is just a projection map?) However, I don’t know how to explicitly describe it.

To compute $left|mathcal{O}_K / mmathcal{O}_Kright|$, from the proposition above we know that $mathcal{O}_K cong mathbb{Z}^{[K : mathbb{Q}]}$, so $mathcal{O}_K / mmathcal{O}_K$ is just $left(mathbb{Z} / mmathbb{Z}right)^{[K : mathbb{Q}]}$ and the order is $m^{[K : mathbb{Q}]}$. This part makes sense but feels a little hand wavy? Or is it justified as is?


(c) Use (b) to show that every nonzero ideal of $mathcal{O}_K$ is a free $mathbb{Z}$-module of rank $[K : mathbb{Q}]$.

My solution: Fix a nonzero ideal $mathfrak{a} subset mathcal{O}_K$. We know that $mathcal{O}_K / mathfrak{a}$ is finite and $mathcal{O}_K cong mathbb{Z}^{[K : mathbb{Q}]}$, so $mathfrak{a}$ has to be a product of $[K : mathbb{Q}]$ infinite subgroups of $mathbb{Q}$, i.e. $mathfrak{a} cong prod_{i = 1}^{[K : mathbb{Q}]} m_imathbb{Z}$. This is easy to prove by a simple proof by contradiction.


(d) If we have ideals $mathfrak{a}_1 subset mathfrak{a}_2 subset cdots$, show that there is an integer $n$ such that $mathfrak{a}_n = mathfrak{a}_{n + 1} = cdots$. Hint: consider the surjections $mathcal{O}_K / mathfrak{a}_1 to mathcal{O}_K / mathfrak{a}_2 to cdots$, and use (b).

My solution: Again, my intuition tells me the surjections $mathcal{O}_K / mathfrak{a}_i to mathcal{O}_K / mathfrak{a}_{i + 1}$ exists, but I don’t know how to construct them. Anyways, I claim that if $mathfrak{a}_i neq mathfrak{a}_{i + 1}$, then $left|mathcal{O}_K / mathfrak{a}_{i + 1}right| < left|mathcal{O}_K / mathfrak{a}_iright|$. This holds because for $alpha in mathfrak{a}_{i + 1} setminus mathfrak{a}_i$ is a nonzero element in the kernel of the surjection. Since the quotients are finite, it must eventually stop and hence there are no infinite ascending chains.


(e) Use (b) to show that a nonzero prime ideal of $mathcal{O}_K$ is maximal.

My ideas: Let $mathfrak{a}$ be a prime ideal of $mathcal{O}_K$, and suppose that $mathfrak{a} supset mathfrak{b}$ (i.e. $mathfrak{a}$ is not maximal), which gives $mathcal{O}_K / mathfrak{b} subset mathcal{O}_K / mathfrak{a}$. Thinking about everything as $mathbb{Z}$-modules, we can write $mathcal{O}_K cong prod_{i = 1}^{[K : mathbb{Q}]} mathbb{Z}$ as ordered coordinates, and similar that $mathcal{O}_K / mathfrak{b} cong prod_{i = 1}^{[K : mathbb{Q}]} mathbb{Z} / m_i mathbb{Z}$ and $mathcal{O}_K / mathfrak{a} cong prod_{i = 1}^{[K : mathbb{Q}]} mathbb{Z} / n_i mathbb{Z}$. By the inclusion, we know that $m_i mid n_i$, and for at least one $j$, $m_j neq n_j$. However, for such $j$ we have that $n_j = m_j cdot left(frac{n_j}{m_j}right)$ i.e. $mathbb{Z} / n_j mathbb{Z}$ is not an integral domain, and hence the product ring is not an integral domain, which means $mathfrak{a}$ is not prime.


For you for your help in advance!

enter image description here

  • Ошибка key in ignition lock рендж ровер
  • Ошибка kernelbase dll код события 1000
  • Ошибка kernel thread priority floor violation
  • Ошибка kernel security check failure при установке windows 10
  • Ошибка kernel security check failure windows 10 что значит