hello,
I use ssleay for crypt and decrypte a password,le same password I wants
the decrypte with
iaik.
I have two questions how I make to have the same format of display in
IAIK and SSLeay.
how I make for being able crypt out of C and decrypte in java.
thank you beacoup for your assistance
here the essence of my code
#define INIT_VECTOR "12345678"
#define CLIENT_KEY "salu"
#define ENCRYPT 1
#define DECRYPT 0
#define ALG EVP_des_ede_cbc()
static int do_cipher(char *p_string,char *p_key,int st_len,int
key_len,int i_action) {
EVP_CIPHER_CTX ectx;
int readlen ;
char *pstRef = p_string ;
unsigned char iv [EVP_MAX_IV_LENGTH] ;
unsigned char key[EVP_MAX_KEY_LENGTH] ;
unsigned char *pcSrc = (unsigned char*) p_key ;
unsigned char *pcDst = iv ;
unsigned char *pcDLast = iv + sizeof(iv) ;
unsigned char *pcSLast = (unsigned char*) p_key + key_len ;
while (pcSrc < pcSLast && pcDst < pcDLast)
*pcDst++ = *pcSrc++ ;
EVP_BytesToKey(ALG,EVP_md5(),(unsigned char *)CLIENT_KEY,(unsigned char
*)p_key,key_len,1,key,iv);
EVP_CipherInit(&ectx,ALG,key,iv,i_action);
printf("key : %s\n",key);
printf("iv :%s et sa taille est :%d\n",iv,strlen(iv));
EVP_CipherUpdate(&ectx,(unsigned char *)p_string,&readlen,(unsigned
char *)p_string,st_len);
p_string += readlen ;
EVP_CipherFinal(&ectx,(unsigned char *)p_string,&readlen);
p_string += readlen ;
*p_string = 0 ;
return p_string - pstRef ;
}
I don't see any such equivalent in IAIK.
IvParameterSpec param = new IvParameterSpec(cbc_iv);
key = new SecretKey(hello, "DESede/cbc");
Cipher cipher = Cipher.getInstance("DESede/BCB", "IAIK");
cipher.init(Cipher.DECRYPT_MODE, key,param);
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]