Bit confusing... are you saying that i need to add NULL termination at the
end of encrypted data? Isn't this wrong?  I assume i shouldn't be NULL
terminating the input string which needs to be encrypted.

On Thu, Mar 29, 2012 at 7:10 PM, Ken Goldman <kgold...@us.ibm.com> wrote:

> On 3/29/2012 1:40 AM, Prashanth kumar N wrote:
>
>> Thanks Ken for pointing out the mistake...  after changing to
>> AES_Decrypt(), it worked but i still see issue when i print the
>> decrypted output as it has extra non-ascii characters in it.
>>
>
> That's what happens in C if you try to printf an array that's not NUL
> terminated.  The printf just keeps going, right past the end of the buffer,
> until it either hits a \0 or segfaults.
>
> You encrypted 16 bytes, not nul terminated, decrypted to the same 16
> bytes, then pretended that it was nul terminated and tried to printf.
>
>
>  Below is the input
>>  unsigned char text[]="test12345678abc2";
>> After decryption, i get the following string: Decrypted o/p:
>> test12345678abc2Ȳu�z�B��� ��A��S�� Few questions...
>>
>> 1. If we use AES, will decrypted files have same number of bytes as
>> encrypted file? (I assume it should be same)
>>
>
> It depends on the mode and padding scheme.  Some (CTR, OFB) don't pad,
> some (CFC) do pad.
>
> If you're just playing, fine.  But if this is a real product you're
> designing, you shouldn't be asking this question.  It's time to hire a
> crypto expert.  Otherwise, your product will be insecure.
>
> My requirement is mainly to support AES XTS but the reason for asking the
> above question was to understand if their is addition of extra bytes to
> encrypted data as it might consume more space when written to a drive...
> does my question make sense?
>


>
>
>
>
>
>
> ______________________________**______________________________**__________
> OpenSSL Project                                 http://www.openssl.org
> User Support Mailing List                    openssl-users@openssl.org
> Automated List Manager                           majord...@openssl.org
>

Reply via email to