In this example code
http://botan.randombit.net/manual/fpe.html
there is a method that I am trying to use in a Visual C++ managed wrapper, but I keep getting compile error on the 'unlock' What is this? (could it be mutex::unlock) And how can i resolve the error?
std::vector<byte> sha1(const std::string& acct_name)
{
SHA_160 hash;
hash.update(acct_name);
return unlock(hash.final());
}
Error 16 error C3861: 'unlock': identifier not found
EDIT: My Stdafx.h file now looks like this but it is still not compiling (even after including secmem.h)
#pragma once
#include <botan/botan.h>
#include <botan/fpe_fe1.h>
#include <botan/sha160.h>
#include <botan/secmem.h>
#include <stdexcept>
#include <vector>
EDIT: Additional information - version of Botan library I'm using is Version 1.10.9 (latest Stable). I compiled using the python script and did not exclude any modules (built it with everything) in debug mode.
I just checked and looks like Botan v. 1.10.9 doesn’t have
unlock
. You have two options.The version 1.10.9 has another
final
method where you can pass a vector ofbyte
as reference to get the return.Something like:
Another option is to convert from
SecureVector
tostd::vector
.Depending of my application, I would chose one over the other.
.
Just in case someone come to this question and is using Botan 1.11.
The method
unlock
to convert fromSecureVector
tostd::vector
is in the headersecman.h
. In addition, the class SHA_160 has anotherfinal
method where you can pass as a parameter astd::vector<byte>
to get the output. With this method, you wouldnt need the unlock function.