在Qt中编译botan示例时出错 [英] Error while compiling botan sample example in Qt
问题描述
我试图找出两天的错误,但仍然没有这个未知的原因。
I am trying to find out the error for two days but still haven't got this unknown reason figure out.
我已经配置和编译了Botan库。一切正常,但尝试编写此示例代码以运行时。
I have configured and compiled Botan library. Everything goes ok but when try to write this sample code to be run..
S2K* s2k = get_s2k("PBKDF2(SHA-256)");
s2k->set_iterations(4049);
SecureVector<byte> key_and_IV = s2k->derive_key(48, passphrase).bits_of();
SymmetricKey key(key_and_IV, 32);
它说错误:'class Botan :: PBKDF'没有名为'set_iterations'的成员
it says error: 'class Botan::PBKDF' has no member named 'set_iterations'
我如何解决这个问题?
推荐答案
Botan docs for v1。 11.1报告函数 get_s2k()
已被弃用,建议您使用 get_pbkdf()
。
The Botan docs for v1.11.1 report that the function get_s2k()
has been deprecated, recommending that you use get_pbkdf()
instead.
get_sdk(algospec)
只是返回调用 get_pbkdf(algo_spec)
的结果, 类的实例
According to the docs, get_sdk(algospec)
just returns the result of a call to get_pbkdf(algo_spec)
which will give you a pointer to an instance of the class
Botan::PBKDF
.
首先,你的代码需要是这样的:
First things first then, your code needs to be something more like:
PBKDF *s2k = getpbkdf("PBKDF2(SHA-256)");
不知道你想要做什么 s2k
我不能帮助任何进一步,因为文档没有引用 PBKDF
的公共成员函数调用 set_iterations()
。你得到你提到的错误,因为 Botan :: PBKDF
真的没有成员名为 set_iterations
。您需要阅读文档,确定 set_iterations()
的目的是在您现在已弃用的示例中,因此如何在较新版本的库中实现该目的。
Unfortunately without knowing what you want to do with s2k
I can't help any further, as the docs have no reference to a public member function of PBKDF
called set_iterations()
. You're getting the error you mention because Botan::PBKDF
really does have no member named set_iterations
. You need to read the docs, work out what the purpose of set_iterations()
was in your now deprecated example and hence how to achieve that purpose in the newer version of the library.
这篇关于在Qt中编译botan示例时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!