简体   繁体   English

有弹性的城堡AES-GCM模式与OpenSSL AES-GCM?

[英]Bouncy Castle AES-GCM mode vs OpenSSL AES-GCM?

I am trying to do some research on AES-GCM. 我正在尝试对AES-GCM进行一些研究。 I am trying to encrypt some data using Bouncy Castle's AES-GCM algorithm implementation and then decrypt it using openSSL's AES-GCM, but I couldn't. 我正在尝试使用Bouncy Castle的AES-GCM算法实现对某些数据进行加密,然后使用openSSL的AES-GCM对其进行解密,但我做不到。
I checked in Bouncy Castle, it returns a single output (ciphertext having length equal to the length of the input plus authentication tag), but in openSSL there are 2 outputs... 1 is the cipher text equal to the length of the input, and the other output is the tag length. 我在Bouncy Castle中检查了一下,它返回一个输出(密文的长度等于输入的长度加上身份验证标签的长度),但是在openSSL中有2个输出... 1是等于输入长度的密文,另一个输出是标签长度。

I checked that both follow the same standard, NIST 800-38D. 我检查了两者是否遵循相同的标准NIST 800-38D。 I checked several of the posts but nowhere was mentioned how to do it. 我检查了几个帖子,但没有人提到如何做。 But also nowhere is it mentioned that we can't. 但是也没有地方提到我们做不到。 Any idea? 任何想法?

You've simply got to concatenate the ciphertext and tag to decrypt with Bouncy or split the ciphertext and tag to verify using OpenSSL. 您只需要连接密文和标记以使用Bouncy解密,或者拆分密文和标记以使用OpenSSL进行验证。 The tag length should be an pre-configured input for the GCM mode, so it should always be possible to distinguish between ciphertext and authentication tag. 标签长度应该是GCM模式的预配置输入,因此应该始终可以区分密文和身份验证标签。

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

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