Luigi Auriemma

aluigi.org (ARCHIVE-ONLY FORUM!)
It is currently 19 Jul 2012 11:24

All times are UTC [ DST ]





Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: ts3clientui_qt.secrets.conf master password
PostPosted: 16 Jun 2010 10:01 

Joined: 13 Aug 2007 21:44
Posts: 4068
Location: http://aluigi.org
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);
}


Top
 Profile  
 
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for: