Annotation of embedaddon/strongswan/src/libstrongswan/plugins/ntru/ntru_private_key.h, revision 1.1.1.1
1.1 misho 1: /*
2: * Copyright (C) 2014 Andreas Steffen
3: * HSR Hochschule fuer Technik Rapperswil
4: *
5: * This program is free software; you can redistribute it and/or modify it
6: * under the terms of the GNU General Public License as published by the
7: * Free Software Foundation; either version 2 of the License, or (at your
8: * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9: *
10: * This program is distributed in the hope that it will be useful, but
11: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13: * for more details.
14: */
15:
16: /**
17: * @defgroup ntru_private_key ntru_private_key
18: * @{ @ingroup ntru_p
19: */
20:
21: #ifndef NTRU_PRIVATE_KEY_H_
22: #define NTRU_PRIVATE_KEY_H_
23:
24: typedef struct ntru_private_key_t ntru_private_key_t;
25:
26: #include "ntru_param_set.h"
27: #include "ntru_public_key.h"
28:
29: #include <library.h>
30: #include <crypto/drbgs/drbg.h>
31:
32: /**
33: * Implements an NTRU encryption public/private key pair
34: */
35: struct ntru_private_key_t {
36:
37: /**
38: * Returns NTRU parameter set ID of the private key
39: *
40: * @return NTRU parameter set ID
41: */
42: ntru_param_set_id_t (*get_id)(ntru_private_key_t *this);
43:
44: /**
45: * Returns the NTRU encryption public key as an encoded binary blob
46: *
47: * @return NTRU encryption public key (must be freed after use)
48: */
49: ntru_public_key_t* (*get_public_key)(ntru_private_key_t *this);
50:
51: /**
52: * Returns the packed encoding of the NTRU encryption private key
53: *
54: * @return Packed encoding of NTRU encryption private key
55: */
56: chunk_t (*get_encoding)(ntru_private_key_t *this);
57:
58: /**
59: * Decrypts an NTRU ciphertext
60: *
61: * @param ciphertext NTRU Ciphertext
62: * @param plaintext Plaintext
63: * @return TRUE if decryption was successful
64: */
65: bool (*decrypt)(ntru_private_key_t *this, chunk_t ciphertext,
66: chunk_t *plaintext);
67:
68: /**
69: * Destroy ntru_private_key_t object
70: */
71: void (*destroy)(ntru_private_key_t *this);
72: };
73:
74: /**
75: * Creates an NTRU encryption public/private key pair using a NIST DRBG
76: *
77: * @param drbg Digital Random Bit Generator used for key generation
78: * @param params NTRU encryption parameter set to be used
79: */
80: ntru_private_key_t *ntru_private_key_create(drbg_t *drbg,
81: const ntru_param_set_t *params);
82:
83: /**
84: * Creates an NTRU encryption private key from encoding
85: *
86: * @param drbg Deterministic random bit generator
87: * @param data Encoded NTRU private key
88: */
89: ntru_private_key_t *ntru_private_key_create_from_data(drbg_t *drbg,
90: chunk_t data);
91:
92: #endif /** NTRU_PRIVATE_KEY_H_ @}*/
93:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>