1f7b8a867b1aea2a52c53f03275372b4fca849d9
[paraslash.git] / crypt.h
1 /*
2 * Copyright (C) 2005-2007 Andre Noll <maan@systemlinux.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
17 */
18
19 /** \file crypt.h prototypes for the RSA crypt functions */
20
21 #include <openssl/pem.h>
22 int para_decrypt_challenge(char *key_file, long unsigned *challenge_nr,
23 unsigned char *buf, int rsa_inlen);
24 int para_encrypt_challenge(RSA* rsa, long unsigned challenge_nr,
25 unsigned char *outbuf);
26 int para_encrypt_buffer(RSA* rsa, unsigned char *inbuf, const unsigned len,
27 unsigned char *outbuf);
28 int para_decrypt_buffer(char *key_file, unsigned char *outbuf, unsigned char *inbuf,
29 int rsa_inlen);
30 int get_rsa_key(char *key_file, RSA **rsa, int private);
31
32 void rsa_free(RSA *rsa);
33
34 /** \cond used to distinguish between loading of private/public key */
35 #define LOAD_PUBLIC_KEY 0
36 #define LOAD_PRIVATE_KEY 1
37 /** \endcond **/