crypto++

Crypto++ and Compressed EC keys

强颜欢笑 提交于 2019-12-06 09:47:48
How can I generate compressed ECDSA keys in Crypto++? AutoSeededRandomPool prng; ECDSA<ECP, SHA1>::PrivateKey privateKey; ECDSA<ECP, SHA1>::PublicKey publicKey; privateKey.Initialize( prng, CryptoPP::ASN1::secp256r1()); const Integer& x1 = privateKey.GetPrivateExponent(); cout << "priv: " << std::hex << x1 << endl; privateKey.MakePublicKey( publicKey ); const ECP::Point& q = publicKey.GetPublicElement(); const Integer& qx = q.x; const Integer& qy = q.y; cout << "pub x: " << std::hex << qx << endl; cout << "pub y: " << std::hex << qy << endl; This code generates a keypair and prints the X and Y

Creation of ECDSA private key given curve and private exponent?

▼魔方 西西 提交于 2019-12-06 07:54:35
I am new to cryptopp and have been struggling for a while with the creation of private keys for ECDSA signing. I have a hex encoded private exponent E4A6CFB431471CFCAE491FD566D19C87082CF9FA7722D7FA24B2B3F5669DBEFB . This is stored as a string. I want to use this to sign a text block using ECDSA. My code looks a bit like this string Sig::genSignature(const string& privKeyIn, const string& messageIn) { AutoSeededRandomPool prng; ECDSA<ECP, SHA256>::PrivateKey privateKey; privateKey.AccessGroupParameters().Initialize(ASN1::secp256r1()); privateKey.Load(StringSource(privKeyIn, true, NULL).Ref());

How to seek in CTR mode and decrypt part of the stream?

怎甘沉沦 提交于 2019-12-06 06:02:11
I have a question in partial decoding in cryptopp. USE AES 256 CTR; Encode source: CTR_Mode< AES >::Encryption e; e.SetKeyWithIV(key, 32, iv); string encrypt; string a = "Example text to encoding"; encrypt.clear(); StringSource s(a, true, new StreamTransformationFilter(e, new StringSink(encrypt) ) ); Decode source: CTR_Mode<AES>::Decryption d; d.SetKeyWithIV(key, 32, iv); string x; StringSource s1(encrypt, true, new StreamTransformationFilter(d, new StringSink(x) ) ); It works fine. But I don't know how decrypt only part. For example, example encrypt.begin()+10 Part Decode: CTR_Mode<AES>:

Creation of ECDSA public key given curve and public point?

泄露秘密 提交于 2019-12-06 04:12:55
I am struggling with the creation of a ECDSA public key from a string representation of a public key i.e string devicePublicKey("86FB5EB3CA0507226BE7197058B9EC041D3A3758D9D9C91902ACA3391F4E58AEF13AFF63CC4EF68942B9B94904DC1B890EDBEABD16B992110624968E894E560E"); previously I found that I had to prefix this key with '04' so not sure if this is require this time? I am trying to generate it to use in verifying a signature string ecs04b2ExpSignature("0199E984CEC75DDCA7F1DDF6E53E2E67352A2BE38A4B66F8ED596606FAB983FF300CAA76DE88CED9D563A5C03E8F3A7C000780F3F2061C611E9AA0B18B460D77"); where the data to

RSA signature in c# and verification in C++ with Crypto++

时光总嘲笑我的痴心妄想 提交于 2019-12-06 02:41:52
I'm trying to sign some bytes in C# thanks to the class RSACryptoServiceProvider and to verify it in C++ with the Crypto++ library. Despite all my attempts, the validation fail although I'm sure of my key and signature. In C# I sign as follow : var message = "hello"; var bytes = System.Text.Encoding.UTF8.GetBytes(message); byte[] signedHash; using (RSACryptoServiceProvider rsa = new RSACryptoServiceProvider()) { // Import the key information. rsa.ImportParameters(privateKey); // Sign the data, using SHA256 as the hashing algorithm signedHash = rsa.SignData(bytes, CryptoConfig.MapNameToOID(

Crypto++ can't build Qt Application

允我心安 提交于 2019-12-05 22:39:43
I am currently trying to run Crypto++ in my Qt Application. But it does not work. Hopefully somebody of you knows whats wrong, because I have not figured it out and I am on this for 3 days now. To concentrate the problem, I have created a test app. Holding this code: http://pastebin.com/1XMARtds taken from http://programmingknowledgeblog.blogspot.de/2013/04/compiling-and-integrating-crypto-into.html My .pro looks like this: TEMPLATE = app CONFIG += console CONFIG -= app_bundle CONFIG -= qt SOURCES += main.cpp win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../Savor_V100/libraries/

library not found due to targetSdkVersion (armeabi-v7a and libcryptopp.so)

╄→гoц情女王★ 提交于 2019-12-05 11:01:42
I have created a sample project that uses Crypto++'s native C++ Libraries and the NDK to generate some ECDH key pairs. You can find the project here . This project runs perfectly fine on most android devices (ran on a handful of 4.4 and 5.0 devices). However I recently ran the app on a Nexus 5 and Nexus 7, both running Android 6.0.1, and the app crashed with the following error. java.lang.UnsatisfiedLinkError: dlopen failed: library "./obj/local/armeabi-v7a/libcryptopp.so" not found I am not really sure what is going on here, as the project obviously has these files, and they should be fine.

Using Crypto++ static library in a QT project

有些话、适合烂在心里 提交于 2019-12-04 19:35:25
I have built cryptopp statically on my system it passes all tests too. These are the warning though I get during tests WARNING: CRYPTOPP_NO_UNALIGNED_DATA_ACCESS is not defined in config.h. WARNING: CRYPTOPP_INIT_PRIORITY is not defined in config.h. WARNING: CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 is defined in config.h. WARNING: You should make these changes in config.h, and not CXXFLAGS. WARNING: You can 'mv config.recommend config.h', but it breaks versioning. WARNING: See http://cryptopp.com/wiki/config.h for more details. I now link this in my QT project file as TEMPLATE = app LIBS

How to build a project using Crypto++ library in kdevelop

 ̄綄美尐妖づ 提交于 2019-12-04 17:43:25
I wrote a small program that uses the crypto++ library using kdevelop in Ubuntu . I get the output correctly when I compile it from the terminal using -lcryptopp . I would like to build and execute the program using the cmake from kdevelop itself. How can I include the CRYPTOPP_DIR in the cmake configuration for doing this. Any help will be appreciated. Thankyou. Adding the following piece of code to cmake file helped me: FIND_LIBRARY(CRYPTOPP crypto++ /usr/lib) ## location of libcryptopp.so or libcryptopp.a IF ( CRYPTOPP ) TARGET_LINK_LIBRARIES(${PROGRAM_NAME} cryptopp ) ## Specifying

AES/CFB encryption with Crypto++ not working

▼魔方 西西 提交于 2019-12-04 06:17:47
问题 I have a simple console program that should encrypt files with AES CFB algorithm from Crypto++ library. For some reason it is not working. Encoding part: byte data[16] = { 0x88, 0x44, 0x88, 0x44, 0x88, 0x44, 0x88, 0x44, 0x88, 0x44, 0x88, 0x44, 0x88, 0x44, 0x88, 0x44 }; byte result[16] = { 0x88, 0x44, 0x88, 0x44, 0x88, 0x44, 0x88, 0x44, 0x88, 0x44, 0x88, 0x44, 0x88, 0x44, 0x88, 0x44 }; //Sample key byte key[16] = { 0x88, 0x44, 0x88, 0x44, 0x88, 0x44, 0x88, 0x44, 0x88, 0x44, 0x88, 0x44, 0x88,