login about faq

This is my code:

rsa.put_EncodingMode("hex");
rsa.put_Utf8(true);
rsa.put_Charset("utf-8");
rsa.ImportPrivateKey(privateKey.c_str());
const char *decryptStr =
rsa.decryptStringENC(inputString.c_str(), true); if (decryptStr != NULL) {
_lastErrorCode = ErrorCode::SUCCESS ; _lastErrorText = ""; return decryptStr; } _lastErrorCode =
ErrorCode::INVALID_INPUT ;
_lastErrorText = string(rsa.lastErrorText()); return
"";

And this is Log when error happening.

ChilkatLog: DecryptStringENC:
DllDate: Mar 11 2016 ChilkatVersion: 9.5.0.56 UnlockPrefix: XXXXXX Architecture: Little Endian; 32-bit Language: Android C/C++
VerboseLogging: 0 usePrivateKey: 1
rsaDecryptBytes: rsa_decrypt:
Pkcs1_5_decode: Invalid PKCS v1.5 PS length ps_len: 126
--Pkcs1_5_decode Packet:
7DB736ED6599DB674C40C8FAF1146E7FC1A52E49773094102E955D3C8D44 B521EF16523DC24333D77C8EC6D4F3316EEB78506623F9DA7746B152062B8211FFB859739EB98CBD0FB15B6AB27 BCF16FC5325F01EA03902EB597158F1FBE83B178EDBCA9B269196C25D7DE590EC4F513D45695FEB3DE464BA7201D1AC1785DF78BF --rsa_decrypt
--rsaDecryptBytes decrypt: Elapsed time: 34 millisec Failed.
--DecryptStringENC
--ChilkatLog

asked May 27 at 23:37

KienNt's gravatar image

KienNt
11

edited May 27 at 23:44


Try setting the rsa.OaepPadding property = true. Maybe OAEP paddding (not PKCSv1.5) was used in the RSA encryption.

Otherwise, using the wrong private key will result in decryption that results in garbage (not the expected format for PCKSv1.5 or OAEP padding from which the original data is unpacked).

link

answered May 29 at 08:32

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

I checked privatekey is correct but still meet error. Data get from server in case meet error have short length is meet error above.

link

answered May 30 at 05:30

KienNt's gravatar image

KienNt
11

I have setted

rsa.put_OaepPadding(true);

But sometimes the above error still appears. I logged the private key everytime decrypt and they are same. So do you have another solution? Thank you.

link

answered May 30 at 07:31

Vinh%20Le's gravatar image

Vinh Le
153

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×98

Asked: May 27 at 23:37

Seen: 301 times

Last updated: May 30 at 07:31

powered by OSQA