login about faq

I'm trying to encrypt/decrypt using RSA-4096 over GRPC (a communication protocol) to a Java SE7 server using javax/crypto/Cipher algorithm's, specifically: RSA/ECB/PKCS1Padding

Java SE7 Crypto Cipher

However over the span of a few hours of trial & erroring, the server is reporting a 'padding error'.

I'm starting to believe it's either the way I'm setting up CkRsa or perhaps the way I'm converting the const unsigned chars to const chars.

I'm setting out my C++ like this:

CkRsa rsa;
rsa.put_littleEndian(false); // Prior to using Chilkat we were using OpenSSL
rsa.put_OAEPPadding(false);  // Uses PKCS#1.5 padding (Confused since Java's cipher says only PKCS1)

// ... setup CkPrivateKey/CkPublicKey with keys via CkStringBuilder

// Encryption
CkByteData outData;
string dump = GetJSONInfo(); // Just returns a JSON string
rsa.EncryptString(dump.c_str(), false, outData); // Encrypt using public key

// GRPC requires the message to be in const string& or const char*
string msg = string(reinterpret_cast<const char*>(const_cast<unsigned char*>(outData.getBytes())), outData.getSize());

// ... Send GRPC request

asked Mar 10 '17 at 16:51

jmazzola's gravatar image

jmazzola
11

edited Mar 10 '17 at 16:51

Be the first one to answer this question!
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:

×85
×74
×54
×28

Asked: Mar 10 '17 at 16:51

Seen: 924 times

Last updated: Mar 10 '17 at 16:51

powered by OSQA