File: gpg.c

package info (click to toggle)
pidgin-encryption 3.1-1
  • links: PTS
  • area: main
  • in suites: squeeze, wheezy
  • size: 2,916 kB
  • ctags: 961
  • sloc: sh: 10,460; ansic: 8,821; makefile: 376; yacc: 318
file content (80 lines) | stat: -rwxr-xr-x 3,276 bytes parent folder | download | duplicates (2)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*     Fake wrapper to illustrate using a different encryption protocol   */
/*             Copyright (C) 2001-2003 William Tompkins                   */

/* This plugin is free software, distributed under the GNU General Public */
/* License.                                                               */
/* Please see the file "COPYING" distributed with this source code        */
/* for more details                                                       */
/*                                                                        */
/*                                                                        */
/*    This software is distributed in the hope that it will be useful,    */
/*   but WITHOUT ANY WARRANTY; without even the implied warranty of       */
/*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU    */
/*   General Public License for more details.                             */

/*   To compile and use:                                                  */
/*     See INSTALL file.                                                  */

#include "internal.h"

#include "cryptproto.h"
#include "gpg.h"
#include "cryptutil.h"
#include "keys.h"


char* gpg_proto_string="GPG 1.00";

crypt_proto* gpg_proto;

/*Functions exported through crypt_proto structure */
static int              gpg_encrypt(unsigned char** encrypted, unsigned char* msg, int msg_len,
                                    crypt_key* inkey);
static int              gpg_decrypt(unsigned char** decrypted, unsigned char* msg, int msg_len,
                                    crypt_key* inkey);
static int              gpg_sign(unsigned char** signedmsg, unsigned char* msg, int msg_len,
                                 crypt_key* key, crypt_key* tokey);
static int              gpg_auth(unsigned char** authed, unsigned char* msg, int msg_len,
                                 crypt_key* key, const char* name);
static crypt_key*       gpg_make_key_from_str(char *key_str);
static GString*         gpg_key_to_gstr(crypt_key* inkey);
static char*            gpg_parseable(char* key);

void gpg_init(int isdefault) {
	gpg_proto = g_malloc(sizeof(crypt_proto));
	crypt_proto_list = g_slist_prepend(crypt_proto_list, gpg_proto);

   gpg_proto->encrypt = gpg_encrypt;
   gpg_proto->decrypt = gpg_decrypt;
   gpg_proto->sign = gpg_sign;
   gpg_proto->auth = gpg_auth;
   gpg_proto->make_key_from_str = gpg_make_key_from_str;
   gpg_proto->key_to_gstr = gpg_key_to_gstr;
	gpg_proto->parseable = gpg_parseable;
   gpg_proto->name = gpg_proto_string;
}

static int  gpg_encrypt(unsigned char** encrypted, unsigned char* msg, int msg_len,
                        crypt_key* inkey)
{ return 0;}

static int gpg_decrypt(unsigned char** decrypted, unsigned char* msg, int msg_len,
                       crypt_key* inkey)
{ return 0;}

static int gpg_sign(unsigned char** signedmsg, unsigned char* msg, int msg_len, crypt_key* key, crypt_key* tokey)
{ return 0;}

static int gpg_auth(unsigned char** authed, unsigned char* msg, int msg_len, crypt_key* key, const char* name)
{ return 0;}

static crypt_key* gpg_make_key_from_str(char *key_str)
 { return 0;}
static GString* gpg_key_to_gstr(crypt_key* key)
 { return 0;}
static char* gpg_parseable(char* key)
 { return 0; }