0

Require code similair to below encrypt on decryption .
below code is to test encryption, similarly can i get code only for testing decryption part of nettle.

/* aes encryption example */
/* LICENSE: LGPL */
/* Compile in nettle (http://www.lysator.liu.se/~nisse/nettle/) source 
directory with gcc -E */
/* Must use gcc on Linux b/c on Mac OS X you will encounter CIL errors */



#define OUTPUT

#include <stdio.h>
#include </home/nettle-3.1/include/nettle/aes.h>
unsigned char plaintext[AES_BLOCK_SIZE] = "0123456789abcdef";
unsigned char ciphertext[AES_BLOCK_SIZE];

struct aes_ctx ctx;
/*unsigned char key[AES_BLOCK_SIZE]="0011223344556677";*/
unsigned char key[AES_BLOCK_SIZE];

int main() {

int i;

aes_set_encrypt_key(&ctx, AES_BLOCK_SIZE, key);/* sets the key for 
expansion*/
aes_encrypt(&ctx, AES_BLOCK_SIZE, ciphertext, plaintext);
printf("AES_BLOCK_SIZE=%d", AES_BLOCK_SIZE);

printf("\nExpected: 14f5fe746966f292651c2288bbff4609\n");
printf("\nActual:   ");

for (i = 0; i < 16; i++) {
printf("%02x", ciphertext[i]);
}
printf("\n");
return 0;
}
adnan
  • 1
  • 1
  • 1
    Maybe next time don’t copy paste useless things but rather ask a question. If you had looked at the formatting of your question you’d see that you actually mostly *increased* the amount of “code” by claiming your paste is code. So please go to the [help] and read on how to use this site. Then fix your question and ask something and maybe someone can help you. – Sami Kuhmonen Jan 17 '19 at 17:48
  • thanx for formatting content, request to kindly help with the code – adnan Jan 17 '19 at 17:55
  • I got the code to check decryption of nettle , thnx a lot – adnan Jan 18 '19 at 10:41

0 Answers0