gpg

  • list public key pubring
    gpg -k

    1
    2
    3
    4
    5
    6
    7
    pub   4096R/7BB9E54D 2014-03-10
    uid EGIS PPS UAT (PPS Testing cert) <egis_support@ogcio.gov.hk>
    sub 4096R/C35F602F 2014-03-10

    pub 4096R/0490D4D2 2017-11-02 [expires: 2019-11-02]
    uid Mars Registry (For PPS Recon. File Encryption) <mars@gmail.com>
    sub 4096R/B3D05CBB 2017-11-02 [expires: 2019-11-02]
  • list private key secring
    gpg -K

    1
    2
    3
    4
    5
    6
    7
    sec   4096R/7BB9E54D 2014-03-10
    uid EGIS PPS UAT (PPS Testing cert) <egis_support@ogcio.gov.hk>
    ssb 4096R/C35F602F 2014-03-10

    sec 4096R/0490D4D2 2017-11-02 [expires: 2019-11-02]
    uid Mars Registry (For PPS Recon. File Encryption) <mars@gmail.com>
    ssb 4096R/B3D05CBB 2017-11-02
  • export public key
    gpg --export --armor 0490D4D2 > ogcio_pps.pub

  • export private key
    gpg --export-secret-keys --armor 0490D4D2 > ogcio_pps.sec

  • list key details to get the key id
    gpg --export 0490D4D2|gpg --list-packets --verbose

  • get key id from gpg file
    gpg --list-packets <filename>

  • sign file
    gpg --output doc.sig --sign doc (default output is doc.gpg)
    gpg --output doc.sig --clearsign doc => (clear text signature)

  • verify and decrypt
    gpg doc.sig

  • sign detached
    gpg --output doc.sig --detach-sig doc

  • verify
    gpg --verify doc.sig doc