15f903308ddd07eed85dddbfeaadc303dbd0cc65
[strongswan.git] / Source / charon / transforms / rsa / rsa_private_key.h
1 /**
2 * @file rsa_private_key.h
3 *
4 * @brief Interface rsa_private_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_PRIVATE_KEY_H_
24 #define RSA_PRIVATE_KEY_H_
25
26 #include <types.h>
27 #include <definitions.h>
28
29 #include <transforms/rsa/rsa_public_key.h>
30 #include <transforms/hashers/hasher.h>
31
32
33 typedef struct rsa_private_key_t rsa_private_key_t;
34
35 /**
36 * @brief RSA private key with associated functions.
37 *
38 * Currently only supports signing using EMSA encoding.
39 *
40 * @ingroup asymmetrics
41 */
42 struct rsa_private_key_t {
43
44 status_t (*build_emsa_pkcs1_signature) (rsa_private_key_t *this, hash_algorithm_t hash_algorithm, chunk_t data, chunk_t *signature);
45
46 status_t (*set_key) (rsa_private_key_t *this, chunk_t key);
47
48 status_t (*get_key) (rsa_private_key_t *this, chunk_t *key);
49
50 status_t (*load_key) (rsa_private_key_t *this, char *file);
51
52 status_t (*save_key) (rsa_private_key_t *this, char *file);
53
54 status_t (*generate_key) (rsa_private_key_t *this, size_t key_size);
55
56 rsa_public_key_t *(*get_public_key) (rsa_private_key_t *this);
57
58 void (*destroy) (rsa_private_key_t *this);
59 };
60
61 /**
62 * Types are defined in public_key.h
63 *
64 * @ingroup asymmetrics
65 */
66 rsa_private_key_t *rsa_private_key_create();
67
68 #endif /*RSA_PRIVATE_KEY_H_*/