簡體   English   中英

Crypto ++無法解釋的崩潰

[英]Crypto++ unexplained crashes

我需要在我的項目中使用加密技術(Visual C ++ 2008 sp1,帶有多個dll的exe,使用一些第三方庫)。 我選擇了Crypto ++庫。 我將其用作靜態庫。 首先,我測試了測試控制台應用程序中所需的所有功能,並且一切正常。

然后,我開始將此功能集成到項目中。

並且它在許多Crypto ++函數調用上崩潰,包括非常簡單的這樣的調用:

CryptoPP::FileSource file("publicKeySign.der", true);

在此代碼行的調用過程中,應用程序崩潰並導致:

Unhandled exception at 0x00c56619 in Starter.exe: 0xC0000005: Access violation reading location 0x00006f70.

這是我的調用堆棧:

Starter.exe!CryptoPP::member_ptr<CryptoPP::AlgorithmParametersBase>::reset(CryptoPP::AlgorithmParametersBase * p=0x00000000)  Line 50 + 0x9 bytes   C++
Starter.exe!CryptoPP::AlgorithmParameters::operator()<char const *>(const char * name=0x00d8ec04, const char * const & value=0x00d88a44, bool throwIfNotUsed=true)  Line 356    C++
Starter.exe!CryptoPP::MakeParameters<char const *>(const char * name=0x00d8ec04, const char * const & value=0x00d88a44, bool throwIfNotUsed=true)  Line 388 + 0x2d bytes    C++
Starter.exe!CryptoPP::FileSource::FileSource(const char * filename=0x00d88a44, bool pumpAll=true, CryptoPP::BufferedTransformation * attachment=0x00000000, bool binary=true)  Line 65 + 0x6d bytes C++
Starter.exe!PDD::PDDApp2::Open()  Line 237  C++
Starter.exe!WinMain(HINSTANCE__ * __formal=0x00c50000, HINSTANCE__ * __formal=0x00c50000, HINSTANCE__ * __formal=0x00c50000, HINSTANCE__ * __formal=0x00c50000)  Line 387 + 0xb bytes   C++
Starter.exe!__tmainCRTStartup()  Line 578 + 0x1d bytes  C
kernel32.dll!@BaseThreadInitThunk@12()  + 0x12 bytes    
ntdll.dll!___RtlUserThreadStart@8()  + 0x27 bytes   
ntdll.dll!__RtlUserThreadStart@8()  + 0x1b bytes    

我的項目和Crypto ++都使用多線程DLL運行時庫。

我試圖將其Crypto ++項目選項更改為與我的項目選項相同,但沒有幫助(在某些更改后應用程序因另一個調用堆棧而崩潰)。

任何想法將不勝感激!

當我深入研究cryptopp時,發現它進行了一些隱藏的驗證。 其中之一在fipstest.cpp中。 但是庫中的try / catch隱藏了實際的異常消息。

當我得到正確的消息時,我發現傳遞的參數對於特定算法(RSA)來說太短了。 這64位只是從網絡示例中獲取的。 當我將密鑰更改為1024時,問題消失了。

干杯;)

AutoSeededRandomPool prng;
RSA::PrivateKey privKey;
//privKey.GenerateRandomWithKeySize(prng, 64);  <- throws exception
privKey.GenerateRandomWithKeySize(prng, 1024);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM