问题描述
我已经看到了许多AES加密和解密编码的示例.这些还包括按键和IV设置.但是,是否可以将密钥导出到外部文件,然后使用类似的方法进行解密过程?
我现在正在使用Crypto ++库.谢谢.
Hi,
I have seen many examples of AES encryption & decryption coding. These also includes the key & iv setup. But, is it possible to export the key to an external file and then use the similar to do a decryption process?
I''m now using the Crypto++ library. Thanks you.
推荐答案
似乎字节数组' 'key'与外部文件"sosemanuk.key"具有不同的值.
It seems that the byte array ''key'' holds a different value from the external file "sosemanuk.key".
我认为您在这里有两个选择之一.
1.将您的代码保留在使用Crypto ++库的状态,然后尝试参考库文档调试问题.
2.忘记sosemanuk(无论是什么)的东西,而只需使用普通的文件管理 [ ^ ]来编写和读取您的字节数组.无论哪种方式,您都需要花一些时间阅读一个或其他文档集.
I think you have one of two options here.
1. Leave your code as it is using the Crypto++ library, and try to debug your problems with reference to the library documentation.
2. Forget the sosemanuk (whatever that is) stuff and just use ordinary File Management[^] to write and read your byte array. Either way you need to spend some time reading one or other sets of documentation.
是否可以将密钥导出到外部文件
is it possible to export the key to an external file
假设您可以将键作为字节数组访问,那么可以使用它进行任何操作.但是,如果键只是库中某些内部结构的句柄,则可能不是那么容易.没有看到密钥本身的特殊性,我无法提供更多的功能.
Assuming you can access the key as a byte array, then yes you can do anything you want with it. However if the key is merely a handle to some internal structure within the library it may not be so easy. Without seeing a sppecification of the key itself I cannot offer anything more.
// Initialize key & iv
byte key[16], iv[16];
AutoSeededRandomPool rng;
rng.GenerateBlock(key, 16);
rng.GenerateBlock(iv, Sosemanuk::IV_LENGTH);
ArraySource (key, sizeof(key), true, new FileSink ("sosemanuk.key"))
;
我是否正确导出/保存了密钥?
谢谢.
;
Did I correctly export/save the key?
Thanks.
这篇关于如何导出AES密钥[Crypto ++]?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!