This is a multi-part message in MIME format.

------=_NextPart_000_0003_01C886E9.E8631A50
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit

Hi:

My system is centos 5.0, the openssl version is openssl-0.9.8b-8.3.el5_0.2.
which is installed by yum mod_ssl.

I try to test AES_set_encrypt_key method. The sorce plaintext is
"userid=6DD024C9F68E894BEFECFE3D7A12E5BA+time=12048 62415". After a
encryption and decryption process, the result turn out to be
"userid=6DD024C9F68E894BEFECFE3D7A12E5BA+time=120"; It seems that the
result's length is the exact times of the block length. I don't know why.
The following is my code. Appreciating for your answer.



char
szBytes[]="BF19EBA2E16593F90196272F131061B1E911FF37A7BA4019D8 46889FDB99EF16A
90B024EF5D4B45EDE260DD045A7376B5B2107A73EDDE27C747 F91794E4E55A6";

unsigned char arrKey[] = "AaCD,F0~12345678";

unsigned int iKeyLen = strlen(arrKey);

unsigned char szSorPlainText[256]=
"userid=6DD024C9F68E894BEFECFE3D7A12E5BA+time=12048 62415";

unsigned char szCipherText[256];

unsigned char szIniVec[]="12345678asdfghjk";

unsigned char szDesPlainText[256];

int iRet = 0;

int iInputLen = strlen(szSorPlainText);

int iCipherLen = 0;

int i = 0;

AES_KEY key;

memset(szCipherText, 0, 256);

iRet = AES_set_encrypt_key(arrKey, iKeyLen<<3, &key);

AES_cbc_encrypt(szSorPlainText, szCipherText, iInputLen, &key, szIniVec,
AES_ENCRYPT);

iCipherLen = strlen(szCipherText);

iRet = AES_set_decrypt_key(arrKey, iKeyLen<<3, &key);

strcpy(szIniVec, "12345678asdfghjk");



memset(szDesPlainText, 0, 256);

AES_cbc_encrypt(szCipherText, szDesPlainText,iCipherLen, &key, szIniVec,
AES_DECRYPT);


------=_NextPart_000_0003_01C886E9.E8631A50
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

xmlns=3D"urn:schemas-microsoft-comfficeffice" =
xmlns:w=3D"urn:schemas-microsoft-comffice:word" =
xmlns:st1=3D"urn:schemas-microsoft-comffice:smarttags" =
xmlns=3D"http://www.w3.org/TR/REC-html40">


charset=3Dus-ascii">

namespaceuri=3D"urn:schemas-microsoft-comffice:smarttags"
name=3D"chsdate" downloadurl=3D""/>
namespaceuri=3D"urn:schemas-microsoft-comffice:smarttags"
name=3D"chmetcnv" downloadurl=3D""/>





style=3D'text-justify-trimunctuation'>



style=3D'font-size:
9.0pt;font-family:Arial'>Hi:>>



style=3D'font-size:
9.0pt;font-family:Arial'>My system is centos 5.0, the openssl version is =
openssl- IsROCDate=3D"False" IsLunarDate=3D"False" Day=3D"30" Month=3D"12" =
Year=3D"1899" w:st=3D"on">0.9.8b-8.3.el5_0.2.
which is installed by yum mod_ssl.>>



style=3D'font-size:
9.0pt;font-family:Arial'>I try to test  AES_set_encrypt_key method. =
 The
sorce plaintext is “userid=3D6DD NumberType=3D"1"
Negative=3D"False" HasSpace=3D"False" SourceValue=3D"24" UnitName=3D"C" =
w:st=3D"on">024C
TCSC=3D"0" NumberType=3D"1" Negative=3D"False" HasSpace=3D"False" =
SourceValue=3D"9"
UnitName=3D"F" w:st=3D"on">9F68E894BEFECFE3D TCSC=3D"0"
NumberType=3D"1" Negative=3D"False" HasSpace=3D"False" SourceValue=3D"7" =
UnitName=3D"a"
w:st=3D"on">7A
12E5BA+time=3D NumberType=3D"1"
Negative=3D"False" HasSpace=3D"False" SourceValue=3D"1204862415" =
UnitName=3D"”" w:st=3D"on">1204862415”
.
After a encryption and decryption process, the result turn out to be =
“userid=3D6DD TCSC=3D"0" NumberType=3D"1" Negative=3D"False" HasSpace=3D"False" =
SourceValue=3D"24"
UnitName=3D"C" w:st=3D"on">024C NumberType=3D"1"
Negative=3D"False" HasSpace=3D"False" SourceValue=3D"9" UnitName=3D"F" =
w:st=3D"on">9F
68E894BEFECFE3D TCSC=3D"0" NumberType=3D"1" Negative=3D"False" HasSpace=3D"False" =
SourceValue=3D"7"
UnitName=3D"a" w:st=3D"on">7A12E5BA+time=3D TCSC=3D"0"
NumberType=3D"1" Negative=3D"False" HasSpace=3D"False" =
SourceValue=3D"120" UnitName=3D"”"
w:st=3D"on">120”
;  It seems that the =
result’s length is the exact
times of the block length. I don’t know why.  The following =
is my code. Appreciating
for your answer.>>



style=3D'font-size:
9.0pt;font-family:Arial'>>



style=3D'font-size:
9.0pt;font-family:Arial'>char szBytes[]=3D"BF19EBA2E TCSC=3D"0"
NumberType=3D"1" Negative=3D"False" HasSpace=3D"False" =
SourceValue=3D"16593"
UnitName=3D"F" w:st=3D"on">16593F
NumberType=3D"1" Negative=3D"False" HasSpace=3D"False" =
SourceValue=3D"90196272"
UnitName=3D"F" =
w:st=3D"on">90196272F
131061B1E911FF TCSC=3D"0" NumberType=3D"1" Negative=3D"False" HasSpace=3D"False" =
SourceValue=3D"37"
UnitName=3D"a" =
w:st=3D"on">37A7BA4019D846889FDB99EF TCSC=3D"0" NumberType=3D"1" Negative=3D"False" HasSpace=3D"False" =
SourceValue=3D"16"
UnitName=3D"a" =
w:st=3D"on">16A90B024EF5D4B45EDE260DD TCSC=3D"0" NumberType=3D"1" Negative=3D"False" HasSpace=3D"False" =
SourceValue=3D"45"
UnitName=3D"a" w:st=3D"on">045A7376B5B TCSC=3D"0"
NumberType=3D"1" Negative=3D"False" HasSpace=3D"False" =
SourceValue=3D"2107" UnitName=3D"a"
w:st=3D"on">2107A
73EDDE NumberType=3D"1"
Negative=3D"False" HasSpace=3D"False" SourceValue=3D"27" UnitName=3D"C" =
w:st=3D"on">27C
TCSC=3D"0" NumberType=3D"1" Negative=3D"False" HasSpace=3D"False" =
SourceValue=3D"747"
UnitName=3D"F" w:st=3D"on">747F91794E4E TCSC=3D"0"
NumberType=3D"1" Negative=3D"False" HasSpace=3D"False" =
SourceValue=3D"55" UnitName=3D"a"
w:st=3D"on">55A
6";>>



style=3D'font-size:
9.0pt;font-family:Arial'>unsigned char arrKey[] =3D =
"AaCD,F0~12345678";>>



style=3D'font-size:
9.0pt;font-family:Arial'>unsigned int iKeyLen =3D =
strlen(arrKey);>>



style=3D'font-size:
9.0pt;font-family:Arial'>unsigned char szSorPlainText[256]=3D =
"userid=3D6DD TCSC=3D"0" NumberType=3D"1" Negative=3D"False" HasSpace=3D"False" =
SourceValue=3D"24"
UnitName=3D"C" w:st=3D"on">024C NumberType=3D"1"
Negative=3D"False" HasSpace=3D"False" SourceValue=3D"9" UnitName=3D"F" =
w:st=3D"on">9F
68E894BEFECFE3D TCSC=3D"0" NumberType=3D"1" Negative=3D"False" HasSpace=3D"False" =
SourceValue=3D"7"
UnitName=3D"a" =
w:st=3D"on">7A12E5BA+time=3D1204862415";>> span>



style=3D'font-size:
9.0pt;font-family:Arial'>unsigned char =
szCipherText[256];>>



style=3D'font-size:
9.0pt;font-family:Arial'>unsigned char =
szIniVec[]=3D"12345678asdfghjk";>>



style=3D'font-size:
9.0pt;font-family:Arial'>unsigned char =
szDesPlainText[256];>>



style=3D'font-size:
9.0pt;font-family:Arial'>int iRet =3D 0;>>



style=3D'font-size:
9.0pt;font-family:Arial'>int iInputLen =3D =
strlen(szSorPlainText);>>



style=3D'font-size:
9.0pt;font-family:Arial'>int iCipherLen =3D =
0;>>



style=3D'font-size:
9.0pt;font-family:Arial'>int i =3D 0;>>



style=3D'font-size:
9.0pt;font-family:Arial'>AES_KEY key;>>



style=3D'font-size:
9.0pt;font-family:Arial'>memset(szCipherText, 0, =
256);>>



style=3D'font-size:
9.0pt;font-family:Arial'>iRet =3D AES_set_encrypt_key(arrKey, =
iKeyLen<<3,
&key);>>



style=3D'font-size:
9.0pt;font-family:Arial'>AES_cbc_encrypt(szSorPlainText, szCipherText,
iInputLen, &key, szIniVec,  =
AES_ENCRYPT);>>



style=3D'font-size:
9.0pt;font-family:Arial'>iCipherLen =3D =
strlen(szCipherText);>>



style=3D'font-size:
9.0pt;font-family:Arial'>iRet =3D AES_set_decrypt_key(arrKey, =
iKeyLen<<3,
&key);>>



style=3D'font-size:
9.0pt;font-family:Arial'>strcpy(szIniVec, =
"12345678asdfghjk");>>



style=3D'font-size:
9.0pt;font-family:Arial'>>



style=3D'font-size:
9.0pt;font-family:Arial'>memset(szDesPlainText, 0, =
256);>>



style=3D'font-size:
9.0pt;font-family:Arial'>AES_cbc_encrypt(szCipherText,
szDesPlainText,iCipherLen, &key, szIniVec, =
AES_DECRYPT);>>









------=_NextPart_000_0003_01C886E9.E8631A50--
__________________________________________________ ____________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openssl-users@openssl.org
Automated List Manager majordomo@openssl.org