include path problem, im gonna research about that.
about the namespace begin im gonna post few of the files for you to see at least how its supposed to work. wei dai wrote it somehow and it works, i just need to use that library in order to use cryptography in my solution.
here is a picture of the object browser for you to see that CryptoPP is a namespace
argnames.h
#ifndef CRYPTOPP_ARGNAMES_H<br />
#define CRYPTOPP_ARGNAMES_H<br />
<br />
#include "cryptlib.h"<br />
<br />
NAMESPACE_BEGIN(CryptoPP)<br />
<br />
DOCUMENTED_NAMESPACE_BEGIN(Name)<br />
<br />
#define CRYPTOPP_DEFINE_NAME_STRING(name) inline const char *name() {return #name;}<br />
<br />
CRYPTOPP_DEFINE_NAME_STRING(ValueNames)
CRYPTOPP_DEFINE_NAME_STRING(Version)
CRYPTOPP_DEFINE_NAME_STRING(Seed)
CRYPTOPP_DEFINE_NAME_STRING(Key)
CRYPTOPP_DEFINE_NAME_STRING(IV)
CRYPTOPP_DEFINE_NAME_STRING(StolenIV)
CRYPTOPP_DEFINE_NAME_STRING(Rounds)
CRYPTOPP_DEFINE_NAME_STRING(FeedbackSize)
CRYPTOPP_DEFINE_NAME_STRING(WordSize)
CRYPTOPP_DEFINE_NAME_STRING(BlockSize)
CRYPTOPP_DEFINE_NAME_STRING(EffectiveKeyLength)
CRYPTOPP_DEFINE_NAME_STRING(KeySize)
CRYPTOPP_DEFINE_NAME_STRING(ModulusSize)
CRYPTOPP_DEFINE_NAME_STRING(SubgroupOrderSize)
CRYPTOPP_DEFINE_NAME_STRING(PrivateExponentSize)
CRYPTOPP_DEFINE_NAME_STRING(Modulus)
CRYPTOPP_DEFINE_NAME_STRING(PublicExponent)
CRYPTOPP_DEFINE_NAME_STRING(PrivateExponent)
CRYPTOPP_DEFINE_NAME_STRING(PublicElement)
CRYPTOPP_DEFINE_NAME_STRING(SubgroupOrder)
CRYPTOPP_DEFINE_NAME_STRING(Cofactor)
CRYPTOPP_DEFINE_NAME_STRING(SubgroupGenerator)
CRYPTOPP_DEFINE_NAME_STRING(Curve)
CRYPTOPP_DEFINE_NAME_STRING(GroupOID)
CRYPTOPP_DEFINE_NAME_STRING(PointerToPrimeSelector)
CRYPTOPP_DEFINE_NAME_STRING(Prime1)
CRYPTOPP_DEFINE_NAME_STRING(Prime2)
CRYPTOPP_DEFINE_NAME_STRING(ModPrime1PrivateExponent)
CRYPTOPP_DEFINE_NAME_STRING(ModPrime2PrivateExponent)
CRYPTOPP_DEFINE_NAME_STRING(MultiplicativeInverseOfPrime2ModPrime1)
CRYPTOPP_DEFINE_NAME_STRING(QuadraticResidueModPrime1)
CRYPTOPP_DEFINE_NAME_STRING(QuadraticResidueModPrime2)
CRYPTOPP_DEFINE_NAME_STRING(PutMessage)
CRYPTOPP_DEFINE_NAME_STRING(TruncatedDigestSize)
CRYPTOPP_DEFINE_NAME_STRING(HashVerificationFilterFlags)
CRYPTOPP_DEFINE_NAME_STRING(SignatureVerificationFilterFlags)
CRYPTOPP_DEFINE_NAME_STRING(InputBuffer)
CRYPTOPP_DEFINE_NAME_STRING(OutputBuffer)
CRYPTOPP_DEFINE_NAME_STRING(InputFileName)
CRYPTOPP_DEFINE_NAME_STRING(InputStreamPointer)
CRYPTOPP_DEFINE_NAME_STRING(InputBinaryMode)
CRYPTOPP_DEFINE_NAME_STRING(OutputFileName)
CRYPTOPP_DEFINE_NAME_STRING(OutputStreamPointer)
CRYPTOPP_DEFINE_NAME_STRING(OutputBinaryMode)
CRYPTOPP_DEFINE_NAME_STRING(EncodingParameters)
CRYPTOPP_DEFINE_NAME_STRING(KeyDerivationParameters)
CRYPTOPP_DEFINE_NAME_STRING(Separator)
CRYPTOPP_DEFINE_NAME_STRING(Terminator)
CRYPTOPP_DEFINE_NAME_STRING(Uppercase)
CRYPTOPP_DEFINE_NAME_STRING(GroupSize)
CRYPTOPP_DEFINE_NAME_STRING(Pad)
CRYPTOPP_DEFINE_NAME_STRING(PaddingByte)
CRYPTOPP_DEFINE_NAME_STRING(Log2Base)
CRYPTOPP_DEFINE_NAME_STRING(EncodingLookupArray)
CRYPTOPP_DEFINE_NAME_STRING(DecodingLookupArray)
CRYPTOPP_DEFINE_NAME_STRING(InsertLineBreaks)
CRYPTOPP_DEFINE_NAME_STRING(MaxLineLength)
CRYPTOPP_DEFINE_NAME_STRING(DigestSize)
CRYPTOPP_DEFINE_NAME_STRING(L1KeyLength)
<br />
DOCUMENTED_NAMESPACE_END<br />
<br />
NAMESPACE_END<br />
<br />
#endif<br />
aes.h
#ifndef CRYPTOPP_AES_H<br />
#define CRYPTOPP_AES_H<br />
<br />
#include "rijndael.h"<br />
<br />
NAMESPACE_BEGIN(CryptoPP)<br />
<br />
DOCUMENTED_TYPEDEF(Rijndael, AES);<br />
<br />
typedef RijndaelEncryption AESEncryption;<br />
typedef RijndaelDecryption AESDecryption;<br />
<br />
NAMESPACE_END<br />
<br />
#endif
basecode.h
#ifndef CRYPTOPP_BASECODE_H<br />
#define CRYPTOPP_BASECODE_H<br />
<br />
#include "filters.h"<br />
#include "algparam.h"<br />
#include "argnames.h"<br />
<br />
NAMESPACE_BEGIN(CryptoPP)<br />
<br />
class CRYPTOPP_DLL BaseN_Encoder : public Unflushable<Filter><br />
{<br />
public:<br />
BaseN_Encoder(BufferedTransformation *attachment=NULL)<br />
{Detach(attachment);}<br />
<br />
BaseN_Encoder(const byte *alphabet, int log2base, BufferedTransformation *attachment=NULL, int padding=-1)<br />
{<br />
Detach(attachment);<br />
IsolatedInitialize(MakeParameters(Name::EncodingLookupArray(), alphabet)<br />
(Name::Log2Base(), log2base)<br />
(Name::Pad(), padding != -1)<br />
(Name::PaddingByte(), byte(padding)));<br />
}<br />
<br />
void IsolatedInitialize(const NameValuePairs ¶meters);<br />
size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking);<br />
<br />
private:<br />
const byte *m_alphabet;<br />
int m_padding, m_bitsPerChar, m_outputBlockSize;<br />
int m_bytePos, m_bitPos;<br />
SecByteBlock m_outBuf;<br />
};<br />
<br />
class CRYPTOPP_DLL BaseN_Decoder : public Unflushable<Filter><br />
{<br />
public:<br />
BaseN_Decoder(BufferedTransformation *attachment=NULL)<br />
{Detach(attachment);}<br />
<br />
BaseN_Decoder(const int *lookup, int log2base, BufferedTransformation *attachment=NULL)<br />
{<br />
Detach(attachment);<br />
IsolatedInitialize(MakeParameters(Name::DecodingLookupArray(), lookup)(Name::Log2Base(), log2base));<br />
}<br />
<br />
void IsolatedInitialize(const NameValuePairs ¶meters);<br />
size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking);<br />
<br />
static void CRYPTOPP_API InitializeDecodingLookupArray(int *lookup, const byte *alphabet, unsigned int base, bool caseInsensitive);<br />
<br />
private:<br />
const int *m_lookup;<br />
int m_padding, m_bitsPerChar, m_outputBlockSize;<br />
int m_bytePos, m_bitPos;<br />
SecByteBlock m_outBuf;<br />
};<br />
<br />
class CRYPTOPP_DLL Grouper : public Bufferless<Filter><br />
{<br />
public:<br />
Grouper(BufferedTransformation *attachment=NULL)<br />
{Detach(attachment);}<br />
<br />
Grouper(int groupSize, const std::string &separator, const std::string &terminator, BufferedTransformation *attachment=NULL)<br />
{<br />
Detach(attachment);<br />
IsolatedInitialize(MakeParameters(Name::GroupSize(), groupSize)<br />
(Name::Separator(), ConstByteArrayParameter(separator))<br />
(Name::Terminator(), ConstByteArrayParameter(terminator)));<br />
}<br />
<br />
void IsolatedInitialize(const NameValuePairs ¶meters);<br />
size_t Put2(const byte *begin, size_t length, int messageEnd, bool blocking);<br />
<br />
private:<br />
SecByteBlock m_separator, m_terminator;<br />
size_t m_groupSize, m_counter;<br />
};<br />
<br />
NAMESPACE_END<br />
<br />
#endif<br />
and a cpp
algparam.cpp
<br />
#include "pch.h"<br />
<br />
#ifndef CRYPTOPP_IMPORTS<br />
<br />
#include "algparam.h"<br />
<br />
NAMESPACE_BEGIN(CryptoPP)<br />
<br />
PAssignIntToInteger g_pAssignIntToInteger = NULL;<br />
<br />
bool CombinedNameValuePairs::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const<br />
{<br />
if (strcmp(name, "ValueNames") == 0)<br />
return m_pairs1.GetVoidValue(name, valueType, pValue) && m_pairs2.GetVoidValue(name, valueType, pValue);<br />
else<br />
return m_pairs1.GetVoidValue(name, valueType, pValue) || m_pairs2.GetVoidValue(name, valueType, pValue);<br />
}<br />
<br />
bool AlgorithmParametersBase::GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const<br />
{<br />
if (strcmp(name, "ValueNames") == 0)<br />
{<br />
ThrowIfTypeMismatch(name, typeid(std::string), valueType);<br />
GetParent().GetVoidValue(name, valueType, pValue);<br />
(*reinterpret_cast<std::string *>(pValue) += m_name) += ";";<br />
return true;<br />
}<br />
else if (strcmp(name, m_name) == 0)<br />
{<br />
AssignValue(name, valueType, pValue);<br />
m_used = true;<br />
return true;<br />
}<br />
else<br />
return GetParent().GetVoidValue(name, valueType, pValue);<br />
}<br />
<br />
NAMESPACE_END<br />
<br />
#endif
|