Padding issue with C++ Crypto RC2 encryption

From: kishore (kishore_at_discussions.microsoft.com)
Date: 01/26/05


Date: Wed, 26 Jan 2005 10:45:07 -0800

Hello, I'm using the Crypto API RC2 encryption under Visual Studio 6 C++.

I've written some code and got encryption and decryption working fine.

The problem is when data is encrypted, the data is padded to accommodate for
block size. So I have the data encrypted with these additional characters.
The problem then is when I decrypt it, I get back the decrypted data with
the additional characters. My question(s) are :

1. How can I prevent the additional characters being padded and encrypted?
Is this even possible?

2. If I can't prevent #1 above, how can I extract only the encrypted
substring associated with the original string. If my original string was
"hello", I tried extracting only 5 chars from the encrypted string so I could
use this for decryption to get back "hello", but this didn't work.

Is there a one to one correspondence between the length of a string and the
lenght of an encrypted string? E.g. If have the string "hello" and have it
encrypted, will each letter in "hello" be associated with a single character
in the encrypted string?

Thanks.



Relevant Pages

  • Re: cryptography
    ... The Rijndael class is intended to be the ... > For a couple examples of simple encryption using the RijndaelManaged class ... >> internal static void Encrypt(string StringToCrypt, string fileOut, string ... >> when i run the above code, encryption is smooth,however when decryption ...
    (microsoft.public.dotnet.languages.csharp)
  • PHP mcrypt and VB.NET cryptoservice interop
    ... I am consuming a PHP-based web service over VB.NET but having some problems with encryption. ... but for some reason - the characters in positions 3-6 of the total length of 64 are different compared to original string at PHP side. ... The decryption code follows: ... Dim encryptedStream As MemoryStream = New MemoryStream ...
    (microsoft.public.dotnet.security)
  • Re: Byte array to string and back - newbie question
    ... // Create a symmetric algorithm. ... This is done to make encryption more ... // Encrypt a string into a string using a password ... // Decrypt a byte array into a byte array using a key and an IV ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Using Python To Create An Encrypted Container
    ... an encrypted archive utility designed for secure archiving ... A match string allows you to only extract files matching a given ... Encrypt the string s using passwd and encryption cipher enc ...
    (comp.lang.python)
  • RE: Bad Data using TripleDES Encryption
    ... // first we need to translate the string into an array of bytes ... // chain two crypto stream together - encrypting and base64 encoding ... // set the decryption key and IV ... Bad Data using TripleDES Encryption ...
    (microsoft.public.dotnet.framework.aspnet.security)