如何分发init。向量与通过对称密码加密的数据? [英] How to distribute init. vector with data encrypted via a symmetric cipher?

查看:293
本文介绍了如何分发init。向量与通过对称密码加密的数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为用户提供一种通过对称密码将一些数据加密到文件的服务。用户只需提供密钥,他/她可以为密码提供初始化向量。

I want to provide for the user a service of encrypting some data via symmetric cipher to a file. The user simply provide a key and he/she may provide an initialize vector for the cipher.

文件是否有标准的样子?使用加密数据填充文件并在对话框窗口中显示相应的初始化向量是有意义的。对于其他人看来,初始化向量应该与加密数据一起存储在文件中似乎是合理的。

Is there a standard how the file should look like? It makes sense to fill the file with the encrypted data and show the corresponding initialize vector in a dialog window. It may seem reasonable to someone else that the initialize vector should be stored in the file with the encrypted data.

对我来说重要的是,结果对于

The important thing for me is that the result is useful for a user and he/she won't need to bother with adjustment of the result.

感谢您的评论!

推荐答案

通常的做法是将IV提供为密文文件的第一个块。这样,接收器将前8个字节(DES)或16个字节(AES)作为IV和文件的其余部分作为实际的密文。

It is common practice to provide the IV as the first block of the cyphertext file. That way the receiver just treats the first 8 bytes (DES) or 16 bytes (AES) as the IV and the rest of the file as the actual cyphertext.

使用相同格式的IV,因为你使用的密码:Base64,十六进制,字节数据或任何。

Use the same format for the IV as you are using for the cyphertext: Base64, hex, byte data or whatever.

这篇关于如何分发init。向量与通过对称密码加密的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆