1

(7 replies, posted in wolfCrypt)

K,
Don't worry. This is the temporary code I wrote during my personal research.
The private key and so on are generated temporarily, without any risk.
It doesn't involve any copyright and confidentiality.
It's just an example for testing. All the codes in it can be shared, disclosed and modified at will.
Thanks!
Juhuaguai

2

(7 replies, posted in wolfCrypt)

K,
This is a C + + Project and it didn't use c#,it doesn't need .Net framework。
Try it, you need to install Microsoft Visual Studio 2019, and choose C + + and MFC when installing.
Do you have any mistakes? Can you send an error message?
You can see the relevant code directly in the RsaTestDlg.cpp file.
thank you.
juhuaguai

3

(7 replies, posted in wolfCrypt)

I have uploaded the test code to GitHub.https://github.com/juhuaguai/temptest
It is an MFC project of vs2019.
The code shows the encryption and decryption of OpenSSL and wolfssl respectively.
RSA of OpenSSL works normally.
Wolfssl can't decrypt normally, but its encrypted string can be decrypted by OpenSSL.
Please tell me how to modify the code.
Thank you very much.

WOLFSSL_RSA* ppri_key = NULL;
int nfLen = 128;
unsigned char uszDeData[1024] = {0};
ppri_key = wolfSSL_RSA_new();
ppri_key->e = wolfSSL_BN_bin2bn(PUBLIC_EXPONENT_HEX,3,NULL);
ppri_key->d = wolfSSL_BN_bin2bn(PRIVATE_EXPONENT_HEX,128,NULL);
ppri_key->n = wolfSSL_BN_bin2bn(MODULES_HEX,128,NULL);

int nRet = wolfSSL_RSA_private_decrypt(nfLen,upszEnData,uszDeData,ppri_key,RSA_PKCS1_PADDING);

It returns - 1,and uszDeData is empty.
How to use large number to construct private key to decrypt?Please give me an example. Thanks!
If the upszEnData length exceeds 2048,how to do it?