[cs631apue] How to use iv xor with first block of text
Kun Yao
kyao at stevens.edu
Sun Dec 8 14:14:03 EST 2013
here is my code
EVP_CIPHER *cipher;
EVP_MD *dgst = NULL;
char *password = "password";
char *salt = "salt";
OpenSSL_add_all_algorithms();
if(!(cipher = EVP_get_cipherbyname("aes-256-cbc"))) {
fprintf(stderr, "no such cipher\n");
exit (EXIT_FAILURE);
}
if(!(dgst=EVP_get_digestbyname("sha1"))){
fprintf(stderr, "no such digest\n");
exit (EXIT_FAILURE);
}
if(!EVP_BytesToKey(cipher, dgst, (unsigned char *)salt, (unsigned char
*) password,
strlen(password), 1, key, iv)){
fprintf(stderr, "EVP_BytesToKey failed\n");
exit (EXIT_FAILURE);
}
printf("Key: "); for(i=0; i<cipher->key_len; ++i) { printf("%02X",
key[i]); } printf("\n");
printf("IV: "); for(i=0; i<cipher->iv_len; ++i) { printf("%02X",
iv[i]); } printf("\n");
I get:
Key:32 77a620512acc466929365e66cd642a9dd6bda657a43d15e94827fe0f2ea2d3ab
IV: 16 0ad8a976d716941149a7a1526e9f4dee
-Kun
On Sun, Dec 8, 2013 at 2:05 PM, Jan Schaumann <jschauma at stevens.edu> wrote:
> Kun Yao <kyao at stevens.edu> wrote:
> > Hi, I have following problem in initialisation vector(IV) XOR with first
> > block of text,
>
> Can you post the relevant code excerpts?
>
> What are the specific function calls that are failing and what are the
> errors they are returning?
>
> -Jan
> _______________________________________________
> cs631apue mailing list
> cs631apue at lists.stevens.edu
> https://lists.stevens.edu/mailman/listinfo/cs631apue
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.stevens.edu/pipermail/cs631apue/attachments/20131208/3dfecc3b/attachment.html>
More information about the cs631apue
mailing list