dpglo66848
2016-11-01 01:49
浏览 82
已采纳

Go中正确的非对称文件加密

I need a way to allow multiple people encrypting various files but only one party been able to read them all. I wrote a program in Go by following various online examples but at some point I got the following error:

Error from encryption: crypto/rsa: message too long for RSA public key size

Is RSA the wrong way to go? Is it ok if I break the file into multiple chunks and encrypt them? Is there an asymmetric block cipher that I can easily use?

I read the discussion here and it is said that RSA is not the proper way to go.

Can you also provide with an example?

图片转代码服务由CSDN问答提供 功能建议

我需要一种方法,允许多人加密各种文件,但只有一方能够读取所有文件。 我通过遵循各种在线示例在Go中编写了一个程序,但有时会出现以下错误:

来自加密的错误:crypto / rsa:消息太长,无法使用RSA公钥 大小

RSA是错误的做法吗? 如果将文件分成多个块并加密,可以吗? 我有容易使用的非对称分组密码吗?

我阅读了并在其中解密纯文本并带有rsa-keys-in-go“> ,据说RSA并不是正确的选择。

您还可以提供示例吗?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dpdkqls6399 2017-08-11 11:01
    已采纳

    So I ended up using GPG and my service has one unique private key and I share the public one with my users.

    点赞 打赏 评论
  • doumiao0498 2016-11-01 02:10

    If you need public key asymmetric encryption for data larger than the key size you need to use hybrid encryption. Essentially this is how HTTPS works.

    Hybrid encryption is where the data is encrypted with symmetric key encryption such as AES and that key is encrypted with asymmetric key encryption such as RSA or EC (Elliptic Curve) Cryptography.

    Do not break the file into multiple chunks and encrypt them.

    点赞 打赏 评论

相关推荐 更多相似问题