douyuanqia665858 2016-05-12 11:39
浏览 289

在Golang中使用PGP

I'm trying to encrypt a string using the openPGP package in golang, but so far I haven't been successful.

Nothing that I've tried so far has worked, so I'm looking for any sort of suggestions or fixes.

The only requirements I have is that it should take the public/private key and the string to decrypt as a string, not files.

I tried to use the examples from this post: http://julianyap.com/2014/07/04/gnu-privacy-guard-gpg-examples-using-golang.html

Specifically this example: https://gist.github.com/jyap808/8324818

But when I run that out of the box it saids the following when trying to read the key

openpgp: invalid argument: no armored data found

And I've found no other good example/working package.

I'm starting to run out of options, as I originally tried to do this in PHP, but failed horribly there too. Would be great if anyone could offer some suggestions!

Thanks in advance

  • 写回答

1条回答 默认 最新

  • douchen2595 2017-11-15 01:10
    关注

    Here's a PGP package for Golang that abstracts away most of the complications and is pretty easy to use:

    https://github.com/jchavannes/go-pgp

    Checkout the test file for an example:

    https://github.com/jchavannes/go-pgp/blob/master/pgp/encrypt_test.go

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度