Dear Sir: In the IDEA cryption test program cfb64_test, I don't know why we must use encrytion key as decryption key. can you tell me the reason.
static int cfb64_test(unsigned char *cfb_cipher) { IDEA_KEY_SCHEDULE eks,dks; int err=0,i,n; idea_set_encrypt_key(cfb_key,&eks); idea_set_decrypt_key(&eks,&dks); memcpy(cfb_tmp,cfb_iv,8); n=0; idea_cfb64_encrypt(plain,cfb_buf1,(long)12,&eks, cfb_tmp,&n,IDEA_ENCRYPT); idea_cfb64_encrypt(&(plain[12]),&(cfb_buf1[12]), (long)CFB_TEST_SIZE-12,&eks, cfb_tmp,&n,IDEA_ENCRYPT); if (memcmp(cfb_cipher,cfb_buf1,CFB_TEST_SIZE) != 0) { err=1; printf("idea_cfb64_encrypt encrypt error\n"); for (i=0; i<CFB_TEST_SIZE; i+=8) printf("%s\n",pt(&(cfb_buf1[i]))); } memcpy(cfb_tmp,cfb_iv,8); n=0; //Why we must first use encryption key to decrypt the 17 bytes data at the begining of the encrypted data idea_cfb64_encrypt(cfb_buf1,cfb_buf2,(long)17,&eks, cfb_tmp,&n,IDEA_DECRYPT); ~~~~encryption key //Then we use decryption key to decrypt the else encrypted data idea_cfb64_encrypt(&(cfb_buf1[17]),&(cfb_buf2[17]), (long)CFB_TEST_SIZE-17,&dks, cfb_tmp,&n,IDEA_DECRYPT); ~~~~decryption key if (memcmp(plain,cfb_buf2,CFB_TEST_SIZE) != 0) { err=1; printf("idea_cfb_encrypt decrypt error\n"); for (i=0; i<24; i+=8) printf("%s\n",pt(&(cfb_buf2[i]))); } return(err); } ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]