the "example" code to decrypt the content data:
Code:
/*
by Luigi Auriemma
*/
#include <stdio.h>
#include <stdlib.h>
#include <tomcrypt.h>
int ts3_content_decrypt(unsigned char *tmpkey, unsigned char *data, int datalen) {
symmetric_CTR ctr;
int cipher_idx,
hash_idx,
ks;
long outlen;
unsigned char key[MAXBLOCKSIZE];
register_hash(&sha512_desc);
hash_idx = find_hash("sha512");
if(hash_idx < 0) return(-1);
register_cipher(&aes_desc);
cipher_idx = find_cipher("aes");
if(cipher_idx < 0) return(-1);
ks = hash_descriptor[hash_idx].hashsize;
if(cipher_descriptor[cipher_idx].keysize(&ks) != CRYPT_OK) return(-1);
outlen = sizeof(key);
if(hash_memory(
hash_idx,
tmpkey,
strlen((char *)tmpkey),
key,
&outlen) != CRYPT_OK) return(-1);
if(ctr_start(
cipher_idx,
key + ks,
key,
ks,
0,
CTR_COUNTER_LITTLE_ENDIAN,
&ctr) != CRYPT_OK) return(-1);
if(ctr_decrypt(
data,
data,
datalen,
&ctr) != CRYPT_OK) return(-1);
return(0);
}
// example of TeamSpeak 3 ts3clientui_qt.secrets.conf "content" decrypter
int main(int argc, char *argv[]) {
#define salt "mnJ0C3CXOlkPshg7YHVXyA==" // the salt string as is
#define key "mypassword" // the master password
unsigned char content[] = // the content's decoded base64 data
"put the decoded base64 data of content";
int content_len = sizeof(content) - 1;
ts3_content_decrypt(salt key, content, content_len);
fwrite(content, 1, content_len, stdout);
return(0);
}