how to decrypt the encrypted data, which is encrypted by C Language library, on commandline.

2006-01-13 Thread Tomiyama Hajime
I tried to decrypt the encrypted texts, which is encrypted by C Language 
library,

on commandline , but it didn't work well.
Please tell me how I can decrypt the encrypted texts, encrypted by C 
Language library,

on commandline.


unsigned char outbuf[1024];
int outlen, tmplen;
unsigned char key[] = 0123456789012345;
unsigned char iv[] = ;
char intext[] = Some Crypto Text;
EVP_CIPHER_CTX ctx;
FILE *out;
char outfile[ 256] = .\\outfile.txt;


EVP_CIPHER_CTX_init(ctx);

//Blowfish CBCモードを採用.
EVP_EncryptInit_ex(ctx, EVP_bf_cbc(), NULL, key, iv);

if( !EVP_EncryptUpdate( ctx, outbuf, outlen, ( unsigned char*)intext, 
strlen

(intext)))
{
/* Error */
return 0;
}

if(!EVP_EncryptFinal_ex(ctx, outbuf + outlen, tmplen))
{
/* Error */
return 0;
}
outlen += tmplen;
EVP_CIPHER_CTX_cleanup(ctx);

out = fopen(outfile, wb);
fwrite(outbuf, 1, outlen, out);
fclose(out);



The encrypted texts is output as outfile.txt.
Then, I tried to decrypt the encrypted texts as decfile.txt on commandline.


OpenSSL enc -d -bf-cbc -k 0123456789012345 -iv  -in 
outfile.txt -out

decfile.txt


But, the following massage is displayed, and it can't be decrypted.

bad magic number
error in enc



__
OpenSSL Project http://www.openssl.org
Development Mailing List   openssl-dev@openssl.org
Automated List Manager   [EMAIL PROTECTED]


how to decrypt the encrypted data, which is encrypted by CLanguage library, on commandline.

2006-01-13 Thread Tomiyama Hajime

I tried to decrypt the encrypted texts, which is encrypted by C Language 
library,
on commandline , but it didn't work well.
Please tell me how I can decrypt the encrypted texts, encrypted by C 
Language library,

on commandline.


unsigned char outbuf[1024];
int outlen, tmplen;
unsigned char key[] = 0123456789012345;
unsigned char iv[] = ;
char intext[] = Some Crypto Text;
EVP_CIPHER_CTX ctx;
FILE *out;
char outfile[ 256] = .\\outfile.txt;


EVP_CIPHER_CTX_init(ctx);

//Blowfish CBC mode
EVP_EncryptInit_ex(ctx, EVP_bf_cbc(), NULL, key, iv);

if( !EVP_EncryptUpdate( ctx, outbuf, outlen, ( unsigned char*)intext, 
strlen

(intext)))
{
/* Error */
return 0;
}

if(!EVP_EncryptFinal_ex(ctx, outbuf + outlen, tmplen))
{
/* Error */
return 0;
}
outlen += tmplen;
EVP_CIPHER_CTX_cleanup(ctx);

out = fopen(outfile, wb);
fwrite(outbuf, 1, outlen, out);
fclose(out);



The encrypted texts is output as outfile.txt.
Then, I tried to decrypt the encrypted texts as decfile.txt on commandline.


OpenSSL enc -d -bf-cbc -k 0123456789012345 -iv  -in 
outfile.txt -out

decfile.txt


But, the following massage is displayed, and it can't be decrypted.

bad magic number
error in enc


__
OpenSSL Project http://www.openssl.org
Development Mailing List   openssl-dev@openssl.org
Automated List Manager   [EMAIL PROTECTED]