EldoS | Feel safer!

Software components for data protection, secure storage and transfer

RSA Encryption with ECB and PKCS1Padding

Posted: 04/28/2010 11:33:00
by Matt Wixson (Standard support level)
Joined: 01/23/2007
Posts: 13

I am attempting to encrypt a value using SBB and send it to a (non-SBB) server expecting cipher text encoded with RSA/ECB/PKCS1Padding. Is there a way to specify ECB mode in SBB RSA encryption?

I am currently using the following to encryption code, but the server cannot decrypt it:
SBPublicKeyCrypto.TElRSAPublicKeyCrypto crypto = new SBPublicKeyCrypto.TElRSAPublicKeyCrypto();
crypto.CryptoType = SBPublicKeyCrypto.TSBRSAPublicKeyCryptoType.rsapktPKCS1;
crypto.OutputEncoding = SBPublicKeyCrypto.TSBPublicKeyCryptoEncoding.pkeBinary;
crypto.KeyMaterial = cert.KeyMaterial;
crypto.Encrypt(utfData, 0, utfData.Length, ref encryptedData, 0, ref encryptedSize);
... I then encode using base64 for transmission to server. Server decodes base64 and then attempts to decrypt and fails.

The server fails with an error: RSA padding check PKCS1 type 2, block type is not 02.

Posted: 04/29/2010 06:43:40
by Ken Ivanov (Team)

Thank you for contacting us.

1) ECB is a symmetric cipher mode and has no relation to RSA.
2) Could you please encrypt some arbitrary file with the sample certificate included to the distribution (using your code) and post it here?
Posted: 05/05/2010 15:15:18
by Matt Wixson (Standard support level)
Joined: 01/23/2007
Posts: 13

Your response prompted me to revisit the code. The crypto problem was caused by a configuration problem (i.e. user error).

Thanks for your quick response. Sorry for the false alarm.




Topic viewed 2536 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!