decrypt_test.c
912 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <mcrypt.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include "bigpoint_cclass.h"
#include "bigpoint_crypt.h"
#include "base64.h"
int
main(int argc, char * argv[])
{
char b64d[] = "J4rYV+oJ9+EzoyLy/o8aolRSw51DzDhTyeht/tcdUA6hNNxaVFrW/FXVTfWXzkZgW1oc1D2vwkfQ80PD+iWzcw";
char pass[] = "1234";
char * data = NULL;
char * decrypted = NULL;
size_t length = strlen(b64d);
struct BIGPOINT_CRYPT * crypt = NULL;
data = calloc(length, sizeof(char));
base64_decode(b64d, length, data, &length);
data = realloc(data, length + 1);
data[length] = '\0';
crypt = new(BIGPOINT_CRYPT, MCRYPT_RIJNDAEL_256, MCRYPT_CFB);
decrypted = bigpoint_crypt_decrypt(crypt, data, pass, &length);
delete(crypt);
free(data);
printf("%s\n", decrypted);
free(decrypted);
return 0;
}
// vim: set et ts=4 sw=4: