Commit 1fb326bc461257254fc20cb53921e9eb74d5dacf

Authored by Georg Hopp
1 parent 4bd7cbd0

remove obsolete non conformant tests for crypt

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