crypto++

256-bit Rijndael blocksize?

做~自己de王妃 提交于 2019-12-01 21:43:25
I am trying to port a decryption routine from C# program to C++ using cryptopp, but I have a problem. In the C# program, the key and IV are both 256 bits. So I tried to do something like this: char *hash1 = "......"; std::string hash2; CryptoPP::StringSource(hash1, true,new CryptoPP::Base64Decoder(new CryptoPP::StringSink(hash2))); CryptoPP::Rijndael::Decryption decryptor(key, 32); CryptoPP::CBC_Mode_ExternalCipher::Decryption cbcDecryption( decryptor, iv); CryptoPP::StreamTransformationFilter stfDecryptor(cbcDecryption, (new CryptoPP::StringSink( decryptedData ) )); stfDecryptor.Put(

How to convert CryptoPP::Integer to char*

佐手、 提交于 2019-12-01 21:15:48
I want to convert myVar from CryptoPP:Integer to char* or to String : The code is below : CryptoPP::Integer myVar = pubKey.ApplyFunction(m); std::cout << "result: " << std::hex << myVar<< std::endl; I have been searching the Internet for converting CryptoPP:Integer to char* but I have had no luck finding. So, either it is really a problem with all to convert CryptoPP:Integer to char* , either I didn't understand very well type CryptoPP:Integer within C++ . Can someone help me please? One way, without knowing much more about CryptoPP::Integer other than it clearly supports << as implied by your

encrypt-decrypt single block with AES and Crypto++

戏子无情 提交于 2019-12-01 21:13:45
问题 I need to encrypt single block of AES. I cant use any modes like CBC and other. Every example what i have seen use streaming modes. EDIT: ok, i did it in the next manner, but i really dislike this try. void dec(const byte *key, const byte* xblock, const byte *cipher, byte *plain) { AESDecryption d; try { const NameValuePairs &nvp = MakeParameters("", 0); d.UncheckedSetKey(key, 16, nvp); d.ProcessAndXorBlock(cipher, xblock, plain); } catch(...) {} } 回答1: AES in ECB mode is identical to single

unresolved external symbol, but dumpbin says it's ok

天大地大妈咪最大 提交于 2019-12-01 21:04:46
I downloaded Crypto++ 5.62 and built it with default project settings. In my project I set up the path to cryptopp.lib and defined its name in "Additional Dependencies". Both Crypto++ and my project - VS 2008. During building of my project I get: main.obj : error LNK2001: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const CryptoPP::DEFAULT_CHANNEL" (?DEFAULT_CHANNEL@CryptoPP@@3V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@B) main.obj : error LNK2001: unresolved external symbol "bool (__cdecl* CryptoPP::g

Undefined symbols for architecture x86_64 when building for ARM64

耗尽温柔 提交于 2019-12-01 12:20:20
I built the cryptopp lib to using for an ios application. but isn't working , only told me "Undefined symbols for architecture x86_64: "CryptoPP::ProxyFilter::IsolatedFlush(bool, bool)", referenced from: " and on and on... and I follow the Crypopp wiki page's guideline, but it still crashing. how can I fix that? ld: warning: ignoring file [path]/libcryptopp.a, missing required architecture x86_64 in file [path]/libcryptopp.a (4 slices)CryptoPP::ProxyFilter::IsolatedFlush(bool, bool)", referenced from: ... ... ... (118 things) I tried to build with github's prebuilt cryptopp but it doesn't work

Convert Hex string to bytes in Crypto++

时光毁灭记忆、已成空白 提交于 2019-12-01 09:11:50
I have string of hexadecimals which I need to convert to const byte* . I am using Crypto++ to do hashing and it needs the key to be in const byte* Is there any way i can convert the string of hexadecimal into const byte* using any of the Crypto++ libs or must i need to come up with my own? Maarten Bodewes There is a HexDecoder class in Crypto++. You need to feed this characters. It seems that Crypto++ does not directly distinguish between characters and bytes. So the following line of code supplied by varren will work: StringSource ss(source, true, new HexEncoder(new StringSink(destination)));

What's the difference between templated mode object and external cipher object?

别说谁变了你拦得住时间么 提交于 2019-12-01 08:40:13
问题 As in the title, I am looking for the difference in the cryptopp library between this declaration: CBC_Mode<AES>::Decryption cbcDecryption.SetKeyWithIV(key, AES::DEFAULT_KEYLENGTH, iv); and this one: AES::Decryption aesDecryption(key, AES::DEFAULT_KEYLENGTH); CBC_Mode_ExternalCipher::Decryption cbcDecryption( aesDecryption, iv ); Moreover, I can't understand why with this: AES::Decryption aesDecryption(key, AES::DEFAULT_KEYLENGTH); CBC_Mode_ExternalCipher::Decryption cbcDecryption(

Using Crypto++ in Clion IDE

心已入冬 提交于 2019-12-01 07:29:53
问题 I have some problem with compile correct application in fresh-installed Clion IDE. Earlier I used Code::Blocks and all compiling successfully. Project use pthread and Crypto++ library. I'm already have them installed on my Ubuntu 15.04. And compile Clion project with -pthread flag. But it can't find crypto++ library. How to fix this? My CMake file: cmake_minimum_required(VERSION 3.3) project(Chat) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread") set(SOURCE_FILES include/Chat.h

How to add Crypto++ library to Qt project

冷暖自知 提交于 2019-12-01 06:37:18
I downloaded the Crypto++ source and compiled the cryptlib project in Visual Studio 2013, and then I added the generated .lib file to my Qt project, which made my .pro file look like this: QT += core gui QT += sql greaterThan(QT_MAJOR_VERSION, 4):QT += widgets TARGET = untitled TEMPLATE = app SOURCES += main.cpp\ mainwindow.cpp HEADERS += mainwindow.h \ databasecontrol.h \ test.h FORMS += mainwindow.ui win32:CONFIG(release, debug|release): LIBS += -L$$PWD/ -lcryptlib else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/ -lcryptlibd else:unix: LIBS += -L$$PWD/ -lcryptlib INCLUDEPATH += $

Use previously generated private key in ECIES

你。 提交于 2019-12-01 06:26:23
I wan to encrypt /decrypt data using ECIES , I am using cryptopp for this. AutoSeededRandomPool prng; //get private key generated ECIES<ECP>::Decryptor d0(prng, ASN1::secp256r1()); PrintPrivateKey(d0.GetKey()); //get public key ECIES<ECP>::Encryptor e0(d0); PrintPublicKey(e0.GetKey()); //encrypt the message string em0; // encrypted message StringSource ss1 (message, true, new PK_EncryptorFilter(prng, e0, new StringSink(em0) ) ); //decrypt the message string dm0; // decrypted message StringSource ss2 (em0, true, new PK_DecryptorFilter(prng, d1, new StringSink(dm0) ) ); Everything else is fine