zoukankan      html  css  js  c++  java
  • gpg的使用

    [gpg的使用]

    在Linux系统中,gpg程序可以实现非对称加密。

    下面简单介绍gpg命令的用法:
    一、创建密钥:
    $ gpg --gen-key

    Please select what kind of key you want:(选择密钥的种类)
       (1) DSA and ElGamal (default)
       (2) DSA (sign only)
       (4) RSA (sign only)

    DSA keypair will have 1024 bits.
    About to generate a new ELG-E keypair.
                  minimum keysize is  768 bits
                  default keysize is 1024 bits
        highest suggested keysize is 2048 bits
    What keysize do you want? (1024)(选择密钥的长度)

    Requested keysize is 1024 bits
    Please specify how long the key should be valid.
             0 = key does not expire
          <n>  = key expires in n days
          <n>w = key expires in n weeks
          <n>m = key expires in n months
          <n>y = key expires in n years
    Key is valid for? (0)(选择密钥的有效期)

    You need a User-ID to identify your key; the software constructs the user id
    from Real Name, Comment and Email Address in this form:
        "Heinrich Heine (Der Dichter) <heinrichh@duesseldorf.de>"

    Real name:(密钥的表示名)
    Email address: (Email地址)
    Comment:(说明)

    You need a Passphrase to protect your secret key.
    Enter passphrase:(解密密码)

    密钥建立完成

    二、查看公钥
    $ gpg --list-key

    三、查看私钥
    $ gpg --list-secret-key

    四、公钥删除
    $ gpg --delete-keys 标识名

    五、私钥删除
    $ gpg --delete-secret-keys 标识名

    六、公钥导出
    $ gpg --export 标识名 > 导出文件名(多以asc为文件后缀)

    七、私钥导出
    $ gpg --export-secret-key 标识名 > 导出文件名(多以asc为文件后缀)

    八、密钥导入
    $ gpg --import 密钥文件

    九、加密文件
    $ gpg --recipient 标识名 --encrypt 文件名

    十、解密文件
    $ gpg --output 新文件名 --decrypt 加密文件名

    十一、修改密钥
    $ gpg --edit-key 标识名

    转自: http://blog.chinaunix.net/uid-10697776-id-3324594.html

  • 相关阅读:
    JAVA Unsafe类
    进程通信的五种普通方法
    监控API的实现 周末补
    INLINE HOOK 简单实现
    跨域资源请求方式
    在博客园放入“可运行”javascript代码
    一些学习资源
    XXE篇-本着就了解安全本质的想法,尽可能的用通俗易懂的语言去解释安全漏洞问题
    Mongodb注入
    SSRF篇-本着就了解安全本质的想法,尽可能的用通俗易懂的语言去解释安全漏洞问题
  • 原文地址:https://www.cnblogs.com/tekkaman/p/3324735.html
Copyright © 2011-2022 走看看