Esempio n. 1
0
int main(int argc, char *argv[]) {
  unsigned char data[1024], testblock[1024], plaintext[1024], nonce[16];
  int len;

  char *ciphertext = "L77na/nrFsKvynd6HzOoG7GHTLXsTVu9qvY/2syLXzhPweyyMTJULu/6/kXX0KSvoOLSFQ==";

  len = base64decode(ciphertext, strlen(ciphertext), data);

  memset(nonce, 0, 16);

  aes_ctr_decrypt(data, len, "YELLOW SUBMARINE", 16, nonce, 0, 0);

  data[len] = '\0';

  //hexdump(data, len);
  printf("%s\n", data);

  return 0;
}
Esempio n. 2
0
int main(void)
{
   char key[16] = { 0x36, 0xf1, 0x83, 0x57, 0xbe, 0x4d, 0xbd, 0x77, 0xf0, 0x50, 0x51, 0x5c, 0x73, 0xfc, 0xf9, 0xf2 };
   char iv[16] =  { 0x69, 0xdd, 0xa8, 0x45, 0x5c, 0x7d, 0xd4, 0x25, 0x4b, 0xf3, 0x53, 0xb7, 0x73, 0x30, 0x4e, 0xec };
   char ct[60] =  { 0x0e, 0xc7, 0x70, 0x23, 0x30, 0x09, 0x8c, 0xe7, 0xf7, 0x52, 0x0d, 0x1c, 0xbb, 0xb2, 0x0f, 0xc3,
                    0x88, 0xd1, 0xb0, 0xad, 0xb5, 0x05, 0x4d, 0xbd, 0x73, 0x70, 0x84, 0x9d, 0xbf, 0x0b, 0x88, 0xd3,
                    0x93, 0xf2, 0x52, 0xe7, 0x64, 0xf1, 0xf5, 0xf7, 0xad, 0x97, 0xef, 0x79, 0xd5, 0x9c, 0xe2, 0x9f,
                    0x5f, 0x51, 0xee, 0xca, 0x32, 0xea, 0xbe, 0xdd, 0x9a, 0xfa, 0x93, 0x29 };
   char msg[64];

   if (!has_aes()) {
      fprintf(stderr, "Sorry, this program requires the AES-NI instruction set to run\n");
      return 1;
   }

   aes_set_keys(key);
   aes_ctr_decrypt(ct, msg, iv, 60);
   out_canonical(msg, 60);

   return 0;
}