Help with Encryption Library

M

Mike Carr

I followed the Guide "How To: Create an Encryption Library" of Building Secure ASP.NET Applications: Authentication, Authorization, and Secure Communication. I kept getting an error here:

decStream.FlushFinalBlock() whenever the text to Decrypt was under 7 characters. Is there a minimum text length that TripleDes can Encrypt/Decrypt?
public byte[] Decrypt(byte[] bytesData, byte[] bytesKey)
{
.... decStream.FlushFinalBlock(); <=== HERE...
} //end Decrypt
 
H

Hernan de Lahitte

Michael,

The minimum text lengh for decryption depends on the algorithm block size
expressed in bytes in case you where using a block cipher algorithm like
DES, 3DES, RC2 or Rijndael. If you take for example 3DES with a defualt
blocksize of 64 bits (8 bytes), the minimum length will be 8 bytes. If your
encrypted data size is less then 8 bytes, the encription process will apply
padding to complete the 8 bytes (or a multiple of 8) size. So on every block
ci[her your encrypted data size will always be a multiple of the blocksize
algorithm.

Cheers,
Hernan
--
Hernan de Lahitte
Lagash Systems S.A.
http://weblogs.asp.net/hernandl
Shadowfax Dev Team

This posting is provided "AS IS" with no warranties, and confers no rights.

I followed the Guide "How To: Create an Encryption Library" of Building
Secure ASP.NET Applications: Authentication, Authorization, and Secure
Communication. I kept getting an error here:

decStream.FlushFinalBlock() whenever the text to Decrypt was under 7
characters. Is there a minimum text length that TripleDes can
Encrypt/Decrypt?
public byte[] Decrypt(byte[] bytesData, byte[] bytesKey)
{
....
decStream.FlushFinalBlock(); <=== HERE
....
} //end Decrypt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top