简体   繁体   English

具有多个文件的 Bouncycastle PGP

[英]Bouncycastle PGP with multiple files

I am developing a tool to encrypt one or multiple files using PGP.我正在开发一种使用 PGP 加密一个或多个文件的工具。 So far, I had no problem to encrypt a single files.到目前为止,我对单个文件进行加密没有问题。 For encrypting several files, I had to resort to zip them in a single file, and then encrypt the single file.为了加密多个文件,我不得不求助于 zip 将它们放在一个文件中,然后对单个文件进行加密。 However, I know that Symantec PGP can encrypt several files inside one.PGP file, without having to zip multiple files.但是,我知道赛门铁克 PGP 可以在一个.PGP 文件中加密多个文件,而无需 zip 多个文件。 I think this is a more elegant solution, as one does not have to decrypt and unzip (two steps), but only open the PGP file and then select the files.我认为这是一个更优雅的解决方案,因为不必解密和解压缩(两个步骤),而只需打开 PGP 文件,然后打开 select 文件。 I have only found examples to encrypt a single files, but no information on how to encrypt several ones.我只找到了加密单个文件的示例,但没有关于如何加密多个文件的信息。 For the record, I am using BouncyCastle.作为记录,我正在使用 BouncyCastle。

I fear there is no way around using ZIP compression before encrypting.我担心在加密之前无法使用 ZIP 压缩。

While you could use multiple Literal Data Packets (one per file) inside your message, section 11.3 of RFC4880 hints that there can only be a single Literal Data Packet per message.虽然您可以在消息中使用多个文字数据包(每个文件一个),但RFC4880 的第 11.3 节暗示每条消息只能有一个文字数据包。 This is also the interpretation of the OpenPGP Interoperability Test Suite which shows that quite a bunch of implementations reject messages with more than one Literal Data Packet.这也是对OpenPGP 互操作性测试套件的解释,它表明相当多的实现拒绝带有多个字面数据包的消息。

Going with ZIP is your best option here. ZIP 是您最好的选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM