• GPG入门


     GPG入门练习笔记 

     参考阮一峰的GPG入门教程http://www.ruanyifeng.com/blog/2013/07/gpg.html

    1、加密
        1)刘言机器: 用王老师公钥加密gpg --recipient DBDA805F --output ToTeacherWang.helloword.en.gpg --encrypt helloword.txt 
        2)王老师机器: 王老师用自己的私钥(输入密码)解密gpg --decrypt ToTeacherWang.helloword.en.gpg 
        2)王老师机器: 王老师用自己的私钥(输入密码)解密gpg           ToTeacherWang.helloword.en.gpg  (--decrypt是可以省略的)(会在当前文件夹下生成ToTeacherWang.helloword.en文件)
        
    2、签名
        1)刘言机器: 用刘言的私钥(输入密码)签名gpg --sign helloword.txt 
        1)刘言机器: 用刘言的私钥(输入密码)签名gpg --local-user 8E0D3717 --output ToTeacherWang.helloword.signed2.gpg  --sign helloword.txt   (local-user参数指定用发信者的私钥签名)
        2)王老师机器: 在自己的库中查找哪个公钥能对应上 gpg --verify ToTeacherWang.helloword.signed.gpg
        
    3、加密 + 签名    
        1)刘言机器: gpg --recipient DBDA805F --output ToTeacherWang.helloword.signed.en.gpg --sign --encrypt helloword.txt 
        1)刘言机器: gpg --local-user 8E0D3717 --recipient DBDA805F --output ToTeacherWang.helloword.signed.en.gpg --sign --encrypt helloword.txt 
        
        2)王老师机器解密 + 验签:  gpg  --decrypt    ToTeacherWang.helloword.signed.en.gpg   (输出到屏幕)
        2)王老师机器:  gpg              ToTeacherWang.helloword.signed.en.gpg  (--decrypt是可以省略的)(会在当前文件夹下生成ToTeacherWang.helloword.signed.en文件)
        
        
        
        
    4、导出公钥
    gpg   --armor   --output public-key.liuyan.txt   --export 8E0D3717 
    gpg --export -a 'Fernando Aleman' > RPM-GPG-KEY-faleman  
     
    5、导入公钥  
    gpg --import /root/pubring.TeacherWang.gpg
    gpg --import public-key.liuyan.txt
     
     6、删除公钥
    gpg --delete-key 8E0D3717
    7、查询公钥
    gpg --list-keys
     
     
     
     
     
     
  • 相关阅读:
    Lock、Synchronized锁解析
    js多个计时器互不影响触发
    php Excel文件导入 Spreadsheet_Excel_Reader
    Tcp/ip简介
    对称加密和非对称加密
    AFNetworking 3.0迁移指南
    从 Objective-C 里的 Alloc 和 AllocWithZone 谈起
    iOS 沙盒
    SDWebImage解析
    dSYM文件
  • 原文地址:https://www.cnblogs.com/LiuYanYGZ/p/9433796.html
Copyright © 2020-2023  润新知