「ERROR: You’re using an RSA key with SHA-1, which is no longer allowed. Please use a newer client or a different key type.」エラーの解決方法
エラー内容
ERROR: You're using an RSA key with SHA-1, which is no longer allowed. Please use a newer client or a different key type.
git clone や git fetch、git pull 等を行おうとすると、上記のエラーが発生しました。
日本語に訳すと、
「ERROR: SHA-1でRSA鍵を使用していますが、これはもう許可されていません。新しいクライアントまたは、別の鍵の種類を使用してください」
とのこと。
- SHA-1:ハッシュ関数の1つ。入力に対して160ビットの適当な値を作って返してくれる
- RSA:公開鍵暗号方式で使われる暗号アルゴリズムの1つ
詳細に関しては、GitHubの公式ブログの記事に以下のように記載されていました。
RSA keys (you’ll see ssh-rsa in the public key) are stronger than DSA keys, but older Git clients may use them in combination with a dated signature algorithm that uses SHA-1. Many SSH clients, including OpenSSH 7.2 and newer, support RSA with SHA-2 signatures (signature types rsa-sha2-256 and rsa-sha2-512), which are secure. However, other clients only support the older SHA-1 signatures. SHA-1 is weak, so we’ll stop allowing new RSA client keys to use SHA-1 signatures and require them to use SHA-2 signatures instead. Keys with a valid_after date before the deadline (November 2, 2021) may continue to use SHA-1 signatures for the time being.
Improving Git protocol security on GitHub
要約すると、「OpenSSH7.2以降のSSHクライアントでは、SHA-2によるRSA署名をサポートしていて、安全だけれど、他のSSHクライアントは古くて弱いSHA-1しかサポートしていないから、新しいRSAクライアント鍵にSHA-1署名を使わせるのはやめて、代わりにSHA-2署名を使うように要求するよ」と言っている。
対処方法
SSH鍵をECDSAやEd25519で作成し直して、GitHubのSSH鍵を登録をすることによって解消しました。
- ECDSA:楕円曲線上の演算を用いて、DSA署名を実現する方式
- Ed25519:エドワーズ曲線デジタル署名の実装の1つ
SSH鍵の作成方法
# ECDSAの場合
$ ssh-keygen -t ecdsa -C "example@example.com"
# Ed25519の場合
$ ssh-keygen -t ed25519 -C "example@example.com"
コメント