使用github用户的公钥加密消息。
hubcrypt的Python项目详细描述
#休息室
closed_lock_with_key: | |
---|---|
for your :octocat: |
使用风险自负。
##摘要
使用github用户的公钥加密[*](https://github.com/rgbkrk/hubcrypt/blob/master/README.md#-maximum-message-size-is-based-on-key-size)short消息。
###加密:
`shell $ ./bin/hubencrypt smashwilson secrets.txt secrets.txt.enc Getting the key for smashwilson Converting public key to a PEM PKCS8 public key Encrypting message All done, cleaning up! `
###解密:
`shell $ ./bin/hubdecrypt ~/.ssh/id_rsa secrets.txt.enc secrets.txt Enter pass phrase for /home/ash/.ssh/id_rsa: $ cat secrets.txt Drink more ovaltine. `
##关于
hubcrypt依赖于这样一个事实:您(可能)已经有了公共和私有密钥对,它们的公共密钥很容易通过github的api访问。您可以使用它们来推送代码并登录到服务器。但它们并不局限于这些任务,因为它们可以用于加密任意数据。
通常,公钥用于加密随机生成的会话密钥,以便与对称加密算法一起使用。主要原因是非对称加密通常比对称加密慢得多。例如,[pgp](http://en.wikipedia.org/wiki/Pretty_Good_Privacy#Design)使用这个确切的方案。
开玩笑的是,我对某人说,如果他们想与另一个github用户共享一个小秘密,他们可以用自己的公共ssh密钥对其进行加密。所以,[哈伯克里特是作为主旨诞生的](https://gist.github.com/rgbkrk/7827691)。
就在我发现[其他人](https://github.com/twe4ked/catacomb)以前做过[这方面的变化](https://github.com/jschauma/jass)之后不久。不奇怪,我总是迟到。
当然,你也可以使用gpg,并说服与你交流的其他人也使用gpg。或者您可以使用ssh密钥来加密消息。当然比平白地发送要好。
##要求
收件人需要使用rsa密钥,并将其列为github.com/<;user>;上的最后一个密钥。Linux和OSX在Mavericks之前应该能很好地工作。
如果您的机器不正确地支持ssh-keygen,提交一个问题,我会感叹我没有一个盒子来为您测试它。请寄给我们一台全新的笔记本电脑来测试您的操作系统风格。
##示例用法
`shell $ git clone https://github.com/rgbkrk/hubcrypt.git $ ./hubcrypt/bin/hubencrypt smashwilson secrets.txt secrets.txt.enc Getting the key for smashwilson Converting public key to a PEM PKCS8 public key Encrypting message All done, cleaning up! `
稍后,在[smashwilson](https://github.com/smashwilson)’s计算机:
`shell $ git clone https://github.com/rgbkrk/hubcrypt.git $ ./hubcrypt/bin/hubdecrypt ~/.ssh/id_rsa secrets.txt.enc secrets.txt Enter pass phrase for /home/ash/.ssh/id_rsa: $ cat secrets.txt Drink more ovaltine. `
您可以将shell脚本复制到您喜欢的任何位置,然后只需运行hubeencrypt和hubedecrypt。
或者,只需窃取openssl和ssh keygen命令,然后像老板一样滚动。你会错过那些非常有见地的错误信息。
γ*最大消息大小(基于密钥大小)
当人们运行ssh-keygen时,典型的密钥大小是2048位。你可以根据自己的判断使它更强壮或更瘦。
` Key size (bits) Maximum Message Size (bytes) 768 85 1024 117 2048 246 4096 502 8192 1018 `
#0.0.0(2013-12-8)
- 概念