如何在Windows中为jcenter在bintray上生成gpg签名密钥

9

我无法获取GPG签名密钥。请有人告诉我。谢谢。 enter image description here 如何在Windows中为jcenter生成GPG签名密钥。


1
这个教程很有用:https://inthecheesefactory.com/blog/how-to-upload-library-to-jcenter-maven-central-as-dependency/en - Suragch
4个回答

10

对于Linux / Mac,您可以使用gpg。我从这里了解到如何做到这一点。我需要在以下命令前加上sudo前缀。

  1. Generate the keys

    gpg --gen-key
    

    Follow the defaults but enter your name and email and optionally a password.

  2. List the keys.

    gpg --list-keys
    

    which should show something like this:

    pub   2038R/91E83BF2 2017-05-13
    uid                  Bob <name@example.com>
    sub   2038R/E3872671 2017-05-13
    
  3. Upload the public key to a keyserver

    gpg --keyserver hkp://pool.sks-keyservers.net --send-keys PUBLIC_KEY_ID
    

    replacing PUBLIC_KEY_ID with your id (91E83BF2 in the example above).

  4. Export your public and private keys to a text file

    gpg -a --export name@example.com > public_key_sender.asc
    gpg -a --export-secret-key name@example.com > private_key_sender.asc
    
  5. Copy the contents of these files to Bintray at Edit Profile > GPG signing.

enter image description here


@DeepPatel,你使用了 sudo 吗? - Suragch
1
我在使用 hkp://pool.sks-keyservers.net 时遇到了 "无法连接到主机" 的问题,但是我可以使用 hkp://ipv4.pool.sks-keyservers.net 进行推送。 - simbo1905
1
gpg -a --export name@example.com > public_key_sender.asc 这个命令是干什么的?我在邮件里没收到任何东西。 - niranjan kurambhatti
@niranjankurambhatti 我也遇到了同样的问题,当我运行第4步命令时没有任何问题,但是我没有收到任何邮件。你找到解决方案了吗? - Ninja
1
@Dr.jacky,我不记得为什么在上面的示例中我写了一个短字符串作为公共ID密钥,但是是的,请用你实际获得的长字符串替换它。 - Suragch
显示剩余6条评论

4

Windows用户可以使用GPG4Win生成GPG密钥。
有很多教程可用,例如这个


1
请替换第二个链接。那个网站已被FBI查封。 - Dr.jacky

0

我找到了解决方案,我需要在bintray中配置gpg签名。如果您还没有创建gpg密钥,请按照此教程操作:https://help.github.com/articles/generating-a-new-gpg-key/

在您创建gpg密钥之后,如果您不知道如何以加密形式复制私钥,请在git bash上执行以下步骤:

  1. 列出私钥:gpg --list-secret-keys
  2. 复制[SC]之后(或下面)的长字符串
  3. 导出加密私钥:gpg --export-secret-keys --armor 您已复制的字符串 > private_key.asc
  4. 使用某个编辑器(我使用sublime text)打开private_key.asc,并复制您的私钥

希望这可以帮助到您


0

这里有一个关于生成 gpg-key 的不错教程 https://help.github.com/articles/generating-a-new-gpg-key/

一些注意事项

-对于Ubuntu 14.04,我们需要使用gpg --gen-key而不是gpg --full-generate-keyhttps://askubuntu.com/questions/1019793/how-to-solve-gpg-invalid-option-full-generate-key

-用于生成私钥

gpg --armor --export-secret-keys {sec_value}
eg: gpg --armor --export-secret-keys 3AA5C34371567BD2

-当复制公钥或私钥时,请记得复制全部内容(包括-----BEGIN ...----------END ...-----


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接