RE: EVP_EncryptUpdate problem

2007-12-13 Thread Bian
David, Thank you. Below is my test program. Could you tell me where is wrong? (openssl-0.9.8g, under WidowsXP, VC6++) void select_random_key(unsigned char *key, int b) { int i; RAND_bytes(key, b); for (i = 0; i < b - 1; i++) printf("%02X:", key[i]); printf("%02X\n", key[b

RE: EVP_EncryptUpdate problem

2007-12-12 Thread David Schwartz
> Thks. > > But, I also meet a problem when decrypt data(the encrypted data > is a 16 bytes long ). The code is below: When you say "the encrypted data" is 16 bytes long, do you mean the data you encrypted was 16 bytes long before you encrypted it? Or do you mean that the encryption produced 16

RE: EVP_EncryptUpdate problem

2007-12-12 Thread Bian
Thks. But, I also meet a problem when decrypt data(the encrypted data is a 16 bytes long ). The code is below: int ret; EVP_CIPHER_CTX ctx; EVP_CIPHER_CTX_init(&ctx); ret = EVP_DecryptInit_ex(&ctx, EVP_aes_128_cbc(), 0, key, iv); // ret=1 cout<<"EVP_CIPHER_CTX_block_siz

EVP_EncryptUpdate problem

2007-12-11 Thread Yang Vincet
Hi This is my piece of program: EVP_CIPHER_CTX_init(&ctx); ret = EVP_CIPHER_CTX_set_padding(&ctx, 0); //0 for no padding, 1 for padding // ret ==1 here unsigned char *key = GetKeyPtr(); ret = EVP_EncryptInit(&ctx, EVP_aes_128_cbc(), NULL, NULL); // ret ==1 here ret = EVP

RE: EVP_EncryptUpdate problem

2007-12-10 Thread David Schwartz
> Hi > > This is my piece of program: > > EVP_CIPHER_CTX_init(&ctx); > ret = EVP_CIPHER_CTX_set_padding(&ctx, 0); //0 for no > padding, 1 for padding // ret ==1 here > unsigned char *key = GetKeyPtr(); > ret = EVP_EncryptInit(&ctx, EVP_aes_128_cbc(), NULL, NULL); > // ret ==1

EVP_EncryptUpdate problem

2007-12-10 Thread Bian
Hi This is my piece of program: EVP_CIPHER_CTX_init(&ctx); ret = EVP_CIPHER_CTX_set_padding(&ctx, 0); //0 for no padding, 1 for padding // ret ==1 here unsigned char *key = GetKeyPtr(); ret = EVP_EncryptInit(&ctx, EVP_aes_128_cbc(), NULL, NULL); // ret ==1 here ret = EV