26 #include <netcomm/worldinfo/encrypt.h> 27 #include <netcomm/worldinfo/decrypt.h> 37 #define MAXLENGTH 1200 40 main(
int argc,
char **argv)
44 WorldInfoMessageEncryptor *e =
new WorldInfoMessageEncryptor((
const unsigned char *)
"QAKEY",
45 (
const unsigned char *)
"QAIV123456");
46 WorldInfoMessageDecryptor *d =
new WorldInfoMessageDecryptor((
const unsigned char *)
"QAKEY",
47 (
const unsigned char *)
"QAIV123456");
50 char *input = (
char *)malloc(MAXLENGTH);
51 char *output = (
char *)malloc(MAXLENGTH);
52 e->set_plain_buffer(input, MAXLENGTH);
53 char *crypted = (
char *)malloc(e->recommended_crypt_buffer_size());
54 e->set_crypt_buffer(crypted, e->recommended_crypt_buffer_size());
56 strncpy(input,
"Test String 12345", MAXLENGTH);
57 printf(
"Plain text: %s\n", input);
59 e->set_plain_buffer(input, strlen(input));
60 long unsigned int bytes = e->encrypt();
62 printf(
"Encrypted to %lu bytes ", bytes);
68 memset(output, 0, MAXLENGTH);
69 d->set_crypt_buffer(crypted, bytes);
70 d->set_plain_buffer(output, MAXLENGTH);
73 printf(
"Decrypted to %lu bytes: %s\n", bytes, output);
Fawkes library namespace.