10343f5daaee3254acf0c55951eccc653c69541d
[strongswan.git] / Source / charon / transforms / rsa / rsa_public_key.h
1 /**
2 * @file rsa_public_key.h
3 *
4 * @brief Interface rsa_public_key_t.
5 *
6 */
7
8 /*
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * for more details.
21 */
22
23 #ifndef RSA_PUBLIC_KEY_H_
24 #define RSA_PUBLIC_KEY_H_
25
26 #include <gmp.h>
27
28 #include <types.h>
29 #include <definitions.h>
30
31
32 typedef struct rsa_public_key_t rsa_public_key_t;
33
34 /**
35 * @brief RSA public key with associated functions.
36 *
37 * Currently only supports signature verification using
38 * the EMSA encoding (see PKCS1)
39 *
40 * @ingroup asymmetrics
41 */
42 struct rsa_public_key_t {
43
44 status_t (*verify_emsa_pkcs1_signature) (rsa_public_key_t *this, chunk_t data, chunk_t signature);
45
46 status_t (*set_key) (rsa_public_key_t *this, chunk_t key);
47
48 status_t (*get_key) (rsa_public_key_t *this, chunk_t *key);
49
50 status_t (*load_key) (rsa_public_key_t *this, char *file);
51
52 status_t (*save_key) (rsa_public_key_t *this, char *file);
53
54 void (*destroy) (rsa_public_key_t *this);
55 };
56
57 /**
58 *
59 * @ingroup asymmetrics
60 */
61 rsa_public_key_t *rsa_public_key_create();
62
63 #endif /*RSA_PUBLIC_KEY_H_*/