build: fixed licensing project
* fixed license includes for windows
This commit is contained in:
@@ -30,9 +30,12 @@ For Win32:
|
||||
Build release lib in ${BOTAN_DIR}/release
|
||||
Build debug lib in ${BOTAN_DIR}/debug
|
||||
|
||||
for Windows:
|
||||
for Windows release build:
|
||||
$ python configure.py --cc=msvc --cpu=x86_32 --via-amalgamation --disable-shared
|
||||
|
||||
for Windows debug build:
|
||||
python configure.py --cc=msvc --cpu=x86_32 --via-amalgamation --disable-shared --no-optimizations --with-debug-info
|
||||
|
||||
for other:
|
||||
$ python configure.py --via-amalgamation --disable-shared
|
||||
|
||||
|
||||
@@ -1,21 +1,15 @@
|
||||
#include "License.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <istream>
|
||||
|
||||
// #include "botan/pubkey.h"
|
||||
// #include "botan/base64.h"
|
||||
// #include "botan/passhash9.h"
|
||||
|
||||
#include "botan_all.h"
|
||||
#include "boost/filesystem.hpp"
|
||||
|
||||
// #ifdef BOTAN_HAS_RSA
|
||||
// #include "botan/rsa.h"
|
||||
// #endif
|
||||
|
||||
namespace
|
||||
{
|
||||
std::string trim(const std::string &str)
|
||||
@@ -27,6 +21,7 @@ namespace
|
||||
}
|
||||
|
||||
License::License()
|
||||
: m_rng(std::make_shared<Botan::AutoSeeded_RNG>())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -86,7 +81,7 @@ void License::create(std::string user, std::string version, Botan::RSA_PrivateKe
|
||||
while (size_t got = in.read(buf, sizeof(buf))) {
|
||||
signer.update(buf, got);
|
||||
}
|
||||
std::string signature = Botan::base64_encode(signer.signature(m_rng));
|
||||
std::string signature = Botan::base64_encode(signer.signature(*(m_rng.get())));
|
||||
addSignature(signature);
|
||||
}
|
||||
|
||||
@@ -106,7 +101,7 @@ void License::createMessage(std::string user, std::string version, unsigned int
|
||||
lines.push_back(typestring);
|
||||
std::string versionstring = "Coati " + getVersion();
|
||||
lines.push_back(versionstring);
|
||||
std::string pass9 = Botan::generate_passhash9(versionstring, m_rng);
|
||||
std::string pass9 = Botan::generate_passhash9(versionstring, *(m_rng.get()));
|
||||
lines.push_back(pass9);
|
||||
}
|
||||
|
||||
@@ -293,7 +288,7 @@ std::string License::getLicenseString() const
|
||||
|
||||
std::string License::hashLocation(const std::string& location)
|
||||
{
|
||||
return Botan::generate_passhash9(location, m_rng);
|
||||
return Botan::generate_passhash9(location, *(m_rng.get()));
|
||||
}
|
||||
|
||||
bool License::checkLocation(const std::string& location, const std::string& hash)
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
#ifndef COATI_LICENSE_H
|
||||
#define COATI_LICENSE_H
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
//#include "botan/botan.h"
|
||||
#include "botan_all.h"
|
||||
|
||||
#ifdef BOTAN_HAS_RSA
|
||||
//#include "botan/rsa.h"
|
||||
#endif
|
||||
namespace Botan
|
||||
{
|
||||
class RSA_PublicKey;
|
||||
class RSA_PrivateKey;
|
||||
class AutoSeeded_RNG;
|
||||
}
|
||||
|
||||
class License
|
||||
{
|
||||
@@ -60,7 +61,7 @@ private:
|
||||
std::string m_publicKeyFilename;
|
||||
std::shared_ptr<Botan::RSA_PublicKey> m_publicKey;
|
||||
std::vector<std::string> lines;
|
||||
Botan::AutoSeeded_RNG m_rng;
|
||||
std::shared_ptr<Botan::AutoSeeded_RNG> m_rng;
|
||||
|
||||
const std::string KEY_FILEENDING = ".pem";
|
||||
const std::string BEGIN_LICENSE = "-----BEGIN LICENSE-----";
|
||||
|
||||
Reference in New Issue
Block a user