Error while compiling botan sample example in Qt

一曲冷凌霜 提交于 2019-12-07 22:32:57

问题


I am trying to find out the error for two days but still haven't got this unknown reason figure out.

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);

it says error: 'class Botan::PBKDF' has no member named 'set_iterations'

How can I solve this problem ?


回答1:


The Botan docs for v1.11.1 report that the function get_s2k() has been deprecated, recommending that you use get_pbkdf() instead.

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)");

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.




回答2:


Possibly you missed your library header... as your error message says: 'has no member named...'



来源:https://stackoverflow.com/questions/11899826/error-while-compiling-botan-sample-example-in-qt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!