crypto++

Given filename, how can I get the Adler32 using Crypto++

Given a "string filename", how can I get the Adler32 checksum using the C++ Crypto++ library. I am a little confused about using their FileSource and Sink system. Below I have the skeleton of the code that does MD5, but I can't seem to find any examples or tutorials on the Adler32 usage. string filename = "/tmp/data.txt" string file_ad...

Can I use RSACryptoServiceProvider public/private keys to interop with Crypto++?

I've created a public/private key using RSACryptoServiceProvider and saved it as XML. I can use this to encrypt/decrypt/sign and verify data in .NET. I have another application which is intended to run on a Linux server. I'm developing it in C++ and I'm using Crypto++ for my cryptography needs. I want to share data between these two a...

Java and C++ Cryptography interoperability

I have a message coming from an external company which has been encrypted with our public key using Java. Specifically the java code performing the encryption is - //get instance of cipher using BouncyCastle cryptography provider Cipher cipher = Cipher.getInstance( "RSA/ECB/PKCS1Padding", "BC"); //initialize the cipher with th...

Using Crypto++ generated RSA keys on OpenSSL

Is there a way to use the RSA keys I've generated with the Crypto++ API in OpenSSL? What I am looking for is a way to store the keys in a format that both Crypto++ and OpenSSL can easily open them. I'm writing a licensing scheme and would want to verify signatures and decrypt files using the Crypto++ API, but to generate the license fil...

using PEM certificates in cryptopp

Hello all I am posting here because cryptopp list is... well in a coma! Nobody seems to answer anything there. I've been going through cryptopp trying to decrypt a a file and I am having some trouble right from the start. How fun is this? ;) I was given a certificate in a pfx file and I extracted the certificate from it I then proceed...

crypto++ RSA and "invalid ciphertext"

Hello all Well, I've been going through my personal hell these days I am having some trouble decrypting a message that was encrypted using RSA and I'm always failing with a "RSA/OAEP-MGF1(SHA-1): invalid ciphertext" I have a private key encoded in base64 and I load it: RSA::PrivateKey private_key; StringSource file_pk(PK,tru...

I'm using Crypto++ for RSA encryption. My plain text exceeds FixedMaxPlaintextLength. What should I do?

Should I break the text into chunks? Is RSA the wrong encryption scheme? ...

For the Diffie Helman prime and generator, what key length should I use?

In the code below, from the Crypto++ wiki, is 128 the number I really should be using? CryptoPP::AutoSeededRandomPool arngA; CryptoPP::RandomNumberGenerator& rngA = *dynamic_cast<CryptoPP::RandomNumberGenerator *>(&arngA); CryptoPP::DH dhA(rngA, 128); CryptoPP::Integer iPrime = dhA.GetGroupParameters().GetModulus(); CryptoPP::Integer i...

How do I decrypt a file with Crypto++ that was encrypted with C#

Hi all, I would like to decrypt a file that I previously encrypted with C# using the TripleDESCryptoServiceProvider. Here's my code for encrypting: private static void EncryptData(MemoryStream streamToEncrypt) { // initialize the encryption algorithm TripleDES algorithm = new TripleDESCryptoServiceProvider(); ...

What is the size of a RSA signature in bytes?

I'm currently using Crypto++ to generate a signature for a block of data. I expected the signature to be 20 bytes ( SHA 1 Hash) , as my understanding was that the signature is just an encrypted hash. But when checking with maxsignaturelength and signature length , it seems that it is 192 bytes. Is it normal? ...

How to use Crypto++ to extract the textual information in a file?

I have a file that is signed with a certificate located here. CrytoAPI has not worked out for me because of server differences in 2003 / 2008+, and different file inputs. I am now considering using Crypto++ to get the job done. Essentially, all I would like to do is extract the text information from this file, and others like it, a...

build errors with Crypto++ on iphone

I am trying to build Crypto++ for iPhone but encountering issues. I managed to get it to build to the device by removing a few .asm files and test.cpp but two issues: 1) the simulator gets build errors relating to: {standard input}:13583:suffix or operands invalid for `call' 2) there are hundreds of warnings (kind of annoying) Has a...

using crypto++ on iphone sdk with pycrypto on app engine

Hi, I'm trying to encrypt http requests using crypto++ and decrypt them with pycrypto on the app engine server end. Using Arc4 encryption, I can successfully encrypt and decrypt on the iphone end but when I try decrypting on app engine, the result is garbled. The ciphertext after encrypting on the client is the same as the text receive...

Can anyone explain why my crypto++ decrypted file is 16 bytes short?

In order that I might feed AES encrypted text as an std::istream to a parser component I am trying to create a std::streambuf implementation wrapping the vanilla crypto++ encryption/decryption. The main() function calls the following functions to compare my wrapper with the vanilla implementation: EncryptFile() - encrypt file using my...

Crypto++ AES Decrypt how to?

There are next to no noob guides to crypto++ out there. Or none that I've found anyway. What I want to do is decrypt an array of uchars I generate with another AES encrypter. Where would I start? I have the library built and linking grand. Do I need to set anything up or do I just call a function on my array (and if so what function) ? ...

C++ writing/reading hex values correctly (CryptoPP)

Hello, I am trying to run a program, that encrypts and decrypts using AES. (from http://www.codeproject.com/KB/security/AESProductKey.aspx ) // From aestest1.cpp // Runtime Includes #include <iostream> #include <iomanip> #include <fstream> #include <vector> #include <string> #include "stdafx.h" // Crypto++ Includes #include "cryptlib...

QT and CryptoPP: Converting QString/QChar to be accepted with CryptoPP

Hello, I want to make program that encrypts (later decrypts) user inputted string. Here is beginning for encryption: QString getData = ui->text->toPlainText(); //Data to process std::string output; //Result will be Base32 encoded string, so std::string is fine. Now, I have to convert QString to char* or std::string so it can be accept...

Encrypt/Decrypt with AES

I'm writing small program to encrypt/decrypt files using AES. I'm using Cryptopp library. I need help to understand some things. When I'm encrypting file I should write IV at the beginning of file to decrypt it later? I wan't to check password given do decrypt file was correct. Should I: put some string at beginning of file (ex. TRU...

Why are Crypto++ and Ruby generating slightly different SHA-1 hashes?

I'm using two different libraries to generate a SHA-1 hash for use in file validation - an older version of the Crypto++ library and the Digest::SHA1 class implemented by Ruby. While I've seen other instances of mismatched hashes caused by encoding differences, the two libraries are outputting hashes that are almost identical. For insta...

Getting random output from Crypto++

Can't figure out why I am getting seemingly random output from the Crypto++ RC2 decoder. The input is always the same, but the output is always different. const char * cipher ("o4hk9p+a3+XlPg3qzrsq5PGhhYsn+7oP9R4j9Yh7hp08iMnNwZQnAUrZj6DWr37A4T+lEBDMo8wFlxliuZvrZ9tOXeaTR8/lUO6fXm6NQpa5P5aQmQLAsmu+eI4gaREvZWdS0LmFxn8+zkbgN/zN23x/sYqIz...