crypto++

Decoding Hex Encoded Value with Crypto++

余生颓废 提交于 2019-11-29 16:55:30
I'm new to Cryptopp and I wanted to encode text and decode back to understand how it works. The encoding part works fine but I cannot get the string decoded? Always the decoded string is empty. I asked in Crypto mailing and someone said this code should work but it does not. I would like to know what is wrong. Being new to crypto I cannot see what is wrong. The code: std::string encoded = m_pkey->GetValue().ToStdString();//here under debugger its ok std::string decoded; CryptoPP::StringSource(encoded, true, new CryptoPP::HexDecoder(new CryptoPP::StringSink(decoded))); The Crypto++ wiki has a

Undefined symbols in Crypto++/iOS 64-bit project

拥有回忆 提交于 2019-11-29 16:27:59
I tried to build with github's prebuilt cryptopp but it doesn't work, too. it occur errors like below: Undefined symbols for architecture arm64: "CryptoPP::BufferedTransformation::ChannelFlush(std::string const&, bool, int, bool)", referenced from: vtable for CryptoPP::SimpleProxyFilter in MYCLASSBBB.o vtable for CryptoPP::Bufferless<CryptoPP::Filter> in MYCLASSBBB.o "CryptoPP::Filter::CopyRangeTo2(CryptoPP::BufferedTransformation&, unsigned long long&, unsigned long long, std::string const&, bool) const", referenced from: vtable for CryptoPP::Base64Decoder in MYCLASSBBB.o vtable for CryptoPP:

Crypto++ explicit destruction during encryption/decryption?

非 Y 不嫁゛ 提交于 2019-11-29 14:57:31
I wrote some wrapper functions to encrypt/decrypt files using crypto++. I tried looking in the wiki but could find my answer. I am wondering if I need to explicitly destroy my objects that are created? I found in the wiki that some objects when passed into functions are destroyed for you, but no examples of my exact use were there so I just wanted to be sure. CryptoPP::AutoSeededRandomPool prng; //Key generation byte key[AES::DEFAULT_KEYLENGTH]; prng.GenerateBlock(key, sizeof(key)); //IV generation byte iv[AES::BLOCKSIZE]; prng.GenerateBlock(iv, sizeof(iv)); //print key encoded.clear();

Load PEM encoded private RSA key in Crypto++

北慕城南 提交于 2019-11-29 13:09:26
问题 Often times, user will have PEM encoded RSA private keys. Crypto++ requires that these keys be in DER format to load. I've been asking people to manually convert their PEM files to DER beforehand using openssl like this: openssl pkcs8 -in in_file.pem -out out_file.der -topk8 -nocrypt -outform der That works fine, but some people don't understand how to do that nor do they want to. So I would like to convert PEM files to DER files automatically within the program. Is it as simple as striping

How do I install Crypto++ in Visual Studio 2010?

依然范特西╮ 提交于 2019-11-29 02:15:20
I downloaded http://www.cryptopp.com/#download 5.6.1 and have no clue that to do at this point. I am a total noob and need good instructions. thanks. Nicholas Directly from the readme (Which can be found here Crypto++ Svn Trunk ): * MSVC-Specific Information * On Windows, Crypto++ can be compiled into 3 forms: a static library including all algorithms, a DLL with only FIPS Approved algorithms, and a static library with only algorithms not in the DLL. (FIPS Approved means Approved according to the FIPS 140-2 standard.) The DLL may be used by itself, or it may be used together with the second

Calculate time encryption of AES/CCM in Visual Studio 2017

╄→гoц情女王★ 提交于 2019-11-28 14:46:33
I am using the library Crypto++ 5.6.5 and Visual Studio 2017. How can I calculate the encryption time for AES-CCM? I would like to know how to calculate the encryption time for AES-CCM. The Crypto++ wiki provides an article Benchmarks . It provides a lot of details regarding library performance, how throughput is calculated, and it even references the source code where the actual throughput is measured. Believe it or not, a simple call to clock works just fine to measure bulk encryption. Also see Benchmarks | Timing Loop in the same wiki article. To benchmark AES/CCM, do something like the

ECDSA sign with BouncyCastle and verify with Crypto++

谁说我不能喝 提交于 2019-11-28 14:14:15
Here is the Java code: public static String sign(String data) throws Exception { KeyPair keyPair = loadKeyPair(System.getProperty("user.dir"), "ECDSA"); Signature signature = Signature.getInstance("SHA256withECDSA", "BC"); signature.initSign(keyPair.getPrivate(), new SecureRandom()); byte[] message = data.getBytes(); signature.update(message); byte[] sigBytes = signature.sign(); String signatureStr = new BigInteger(1, sigBytes).toString(16); return signatureStr; } Then the C++ Code to verify signatures bool VerifyMessage( const ECDSA<ECP, SHA256>::PublicKey& key, const string& message, const

Having trouble decrypting a well-formed cipher text using Crypto++

好久不见. 提交于 2019-11-28 14:10:27
Background I've been struggling with decrypting an apparently well-formed cipher text for about a day. Assume we've got the following hex-encoded cipher text which contains exactly 160 characters thereby having 80 bytes. QString c = "1BFAC407AF0D440A2D6176C0B5D125AA96088490299AC18C74623C0EF1BB1372E554FC4150A8066220E943697BE2491D8AE13AA036B298425AC510A8A917D59EBB69708B9040AB3A84C63043EAD4AB07"; QString k = CryptoUtils::hexEncode("abc"); QString p = CryptoUtils::decrypt(c, k); qDebug() << p; Provided we're using AES 256, AFAIK, the key must be of length 32 bytes and cipher text of a length of

Undefined symbols in Crypto++/iOS 64-bit project

醉酒当歌 提交于 2019-11-28 12:01:06
问题 I tried to build with github's prebuilt cryptopp but it doesn't work, too. it occur errors like below: Undefined symbols for architecture arm64: "CryptoPP::BufferedTransformation::ChannelFlush(std::string const&, bool, int, bool)", referenced from: vtable for CryptoPP::SimpleProxyFilter in MYCLASSBBB.o vtable for CryptoPP::Bufferless<CryptoPP::Filter> in MYCLASSBBB.o "CryptoPP::Filter::CopyRangeTo2(CryptoPP::BufferedTransformation&, unsigned long long&, unsigned long long, std::string const&,

Decoding Hex Encoded Value with Crypto++

佐手、 提交于 2019-11-28 11:35:28
问题 I'm new to Cryptopp and I wanted to encode text and decode back to understand how it works. The encoding part works fine but I cannot get the string decoded? Always the decoded string is empty. I asked in Crypto mailing and someone said this code should work but it does not. I would like to know what is wrong. Being new to crypto I cannot see what is wrong. The code: std::string encoded = m_pkey->GetValue().ToStdString();//here under debugger its ok std::string decoded; CryptoPP::StringSource