使用 AES 封装密钥时生成替代初始值
我按照 https://datatracker.ietf.org/doc/html 上的说明进行操作/rfc5649#section-3 我已经到了需要为替代初始值生成LSB(32,A)
的地步(AIV)。我使用 NodeJS 和 缓冲区来实现算法。我的理解是 32-bits === buffer.length == 4
或者换句话说,buffer的长度4就是文章中引用的32位。我在转换缓冲区后填充了密钥,然后用 8 - (length % 8)
的长度值填充 0s
作为文章中所示的值。现在我无法弄清楚的是获取 32 位 MLI 的值。我如何获得MLI
,我只知道它的消息长度指示器
,但这就是我所知道的全部。
示例:
const key = Buffer.from('base64 key', 'base64');
const kek = Buffer.from('A65959A6', 'hex');
现在这里我只有 MSB(32, A)
而没有 LSB(32, A)
,我如何获取该值,以及我正在做什么错误,请帮助我已经花了很多时间试图解决这个问题。
场景:假设我的密钥长度是 75,现在我必须填充剩余的 5 个字符,使其成为 8 的倍数,现在如何生成 LSB(32, A) 在这种情况下?
Am following the instructions on https://datatracker.ietf.org/doc/html/rfc5649#section-3 and I have gotten to a point where I need to generate the LSB(32,A)
for the Alternative Initial Value (AIV). Am using NodeJS with buffers to implement the algorithm. My understanding is 32-bits === buffer.length == 4
or in other words, length 4 of buffer is the 32-bits referenced in the article. I have padded the key after converting it buffer then padding with the length value of 8 - (length % 8)
with 0s
as value as indicated in the article. Now the thing I have not been able to figure out is getting the value of 32-bit MLI
. How do I get the MLI
, I just know its Message Length Indicator
but thats all I know about it.
Example:
const key = Buffer.from('base64 key', 'base64');
const kek = Buffer.from('A65959A6', 'hex');
Now here I have only MSB(32, A)
but not LSB(32, A)
, how do I get the value, and is there anything I am doing wrong, please help I have already spent alot of time trying to figure this out.
Scenario: Let's say my key length is 75, now I have to pad the remaining 5 characters for it to be multiples of 8, now how do I generate LSB(32, A)
in this case?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论