65 lines
2.0 KiB
Markdown
65 lines
2.0 KiB
Markdown
---
|
|
source: https://eax.me/gpg/
|
|
tags: [gpg, gnupg]
|
|
---
|
|
## Генерация подписи
|
|
|
|
```Shell
|
|
$ gpg --full-generate-key
|
|
> 4
|
|
> 4096
|
|
> 0
|
|
> John Doe
|
|
> test@example.com
|
|
> O
|
|
```
|
|
|
|
## Получение списка подписей
|
|
|
|
```Shell
|
|
$ gpg --list-secret-keys --keyid-format SHORT
|
|
/root/.gnupg/pubring.kbx
|
|
------------------------
|
|
sec rsa4096/674CB45A 2020-05-16 [SC] [expires: 2022-05-16]
|
|
65B8A7455C949E73FC3B7330C16132F5674CB45A
|
|
uid [ultimate] John Doe <test@example.com>
|
|
```
|
|
|
|
## Настройка #git
|
|
|
|
```Shell
|
|
$ gpg --armor --export 674CB45A # и добавить результат в github, gitea, etc.
|
|
$ git config --global user.signingkey 674CB45A
|
|
$ git config --global commit.gpgSign true
|
|
$ git config --global tag.gpgSign true
|
|
```
|
|
|
|
[https://docs.github.com/en/authentication/managing-commit-signature-verification/adding-a-new-gpg-key-to-your-github-account](https://docs.github.com/en/authentication/managing-commit-signature-verification/adding-a-new-gpg-key-to-your-github-account)
|
|
|
|
## Удаление подписи
|
|
|
|
```Shell
|
|
$ gpg --delete-secret-keys 674CB45A
|
|
$ gpg --delete-keys 674CB45A
|
|
```
|
|
|
|
## Перенос подписи на другую машину
|
|
|
|
```Shell
|
|
$ gpg --list-secret-keys --keyid-format SHORT
|
|
/root/.gnupg/pubring.kbx
|
|
------------------------
|
|
sec rsa4096/674CB45A 2020-05-16 [SC] [expires: 2022-05-16]
|
|
65B8A7455C949E73FC3B7330C16132F5674CB45A
|
|
uid [ultimate] John Doe <test@example.com>
|
|
|
|
$ gpg --export-secret-keys 674CB45A > private.key
|
|
|
|
# скопировать файл куда надо и выполнить
|
|
$ gpg --import private.key
|
|
```
|
|
|
|
> [!seealso] См. также
|
|
> * [https://withblue.ink/2020/05/17/how-and-why-to-sign-git-commits.html](https://withblue.ink/2020/05/17/how-and-why-to-sign-git-commits.html)
|
|
> * [https://makandracards.com/makandra-orga/37763-gpg-extract-private-key-and-import-on-different-machine](https://makandracards.com/makandra-orga/37763-gpg-extract-private-key-and-import-on-different-machine)
|