Release 1.25.0 -- Buddy Idle Time, RTF
[siplcs.git] / src / core / sipe-crypt.h
blobd8f2a9c86ef8bec0eb870aea3dc196a83d2d1483
1 /**
2 * @file sipe-crypt.h
4 * pidgin-sipe
6 * Copyright (C) 2010-2015 SIPE Project <http://sipe.sourceforge.net/>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 /**
24 * Crypto backend specific initialization/shutdown
26 * TRUE - production mode, i.e. called from sipe-core.c
27 * FALSE - test mode
29 void sipe_crypto_init(gboolean production_mode);
30 void sipe_crypto_shutdown(void);
32 void sipe_crypt_des(const guchar *key,
33 const guchar *plaintext, gsize plaintext_length,
34 guchar *encrypted_text);
36 void sipe_crypt_rc4(const guchar *key, gsize key_length,
37 const guchar *plaintext, gsize plaintext_length,
38 guchar *encrypted_text);
40 /* plaintext & encrypted_text must point to modulus_length long spaces */
41 gboolean sipe_crypt_rsa_encrypt(gpointer public, gsize modulus_length,
42 const guchar *plaintext,
43 guchar *encrypted_text);
44 gboolean sipe_crypt_rsa_decrypt(gpointer private, gsize modulus_length,
45 const guchar *encrypted_text,
46 guchar *plaintext);
47 /* must be g_free'd() */
48 guchar *sipe_crypt_rsa_sign(gpointer private,
49 const guchar *digest, gsize digest_length,
50 gsize *signature_length);
51 gboolean sipe_crypt_verify_rsa(gpointer public,
52 const guchar *digest, gsize digest_length,
53 const guchar *signature, gsize signature_length);
55 /* Stream RC4 cipher for file transfer */
56 gpointer sipe_crypt_ft_start(const guchar *key);
57 void sipe_crypt_ft_stream(gpointer context,
58 const guchar *in, gsize length,
59 guchar *out);
60 void sipe_crypt_ft_destroy(gpointer context);
62 /* Stream RC4 cipher for TLS */
63 gpointer sipe_crypt_tls_start(const guchar *key, gsize key_length);
64 void sipe_crypt_tls_stream(gpointer context,
65 const guchar *in, gsize length,
66 guchar *out);
67 void sipe_crypt_tls_destroy(gpointer context);
69 /* Block AES-CBC cipher for TLS */
70 void sipe_crypt_tls_block(const guchar *key, gsize key_length,
71 const guchar *iv, gsize iv_length,
72 const guchar *in, gsize length,
73 guchar *out);