const std::string getFileName(const std::string &key)
{
- KeyGenerator::data hash = KeyGenerator::MD5(KeyGenerator::data(key.begin(), key.end()));
+ KeyGenerator::data hash = KeyGenerator::SHA256(KeyGenerator::data(key.begin(), key.end()));
std::stringstream fileName;
fileName << "/opt/etc/.ode_";
* See the License for the specific language governing permissions and
* limitations under the License
*/
-#include <openssl/md5.h>
#include <openssl/rand.h>
#include <openssl/crypto.h>
#include <openssl/hmac.h>
#error This requires SHA512
#endif
-#ifdef OPENSSL_NO_MD5
-#error This requires MD5
-#endif
-
namespace ode {
void KeyGenerator::init()
{
EVP_add_cipher(EVP_aes_256_cbc());
- EVP_add_digest(EVP_md5());
EVP_add_digest(EVP_sha256());
EVP_add_digest(EVP_sha512());
}
return ret;
}
-const KeyGenerator::data KeyGenerator::MD5(const data& in)
-{
- data ret(128 / 8);
-
- ::MD5(in.data(), in.size(), ret.data());
-
- return ret;
-}
-
const KeyGenerator::data KeyGenerator::SHA256(const data& in)
{
data ret(256 / 8);
static const data AESDecrypt(const data& in, const data& key, const data& iv);
static const data HMAC(const data& in, const data& key);
static const data RNG(size_t resultSize);
- static const data MD5(const data& in);
static const data SHA256(const data& in);
static const data SHA512(const data& in);
};