]>
Commit | Line | Data |
---|---|---|
ea0823df | 1 | /* |
4a6f97d0 | 2 | * Copyright (C) 2008-2016 Tobias Brunner |
19ef2aec TB |
3 | * |
4 | * Copyright (C) secunet Security Networks AG | |
ea0823df TB |
5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | |
7 | * under the terms of the GNU General Public License as published by the | |
8 | * Free Software Foundation; either version 2 of the License, or (at your | |
9 | * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, but | |
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 | * for more details. | |
ea0823df TB |
15 | */ |
16 | ||
17 | /** | |
18 | * @defgroup openssl_ec_private_key openssl_ec_private_key | |
19 | * @{ @ingroup openssl_p | |
20 | */ | |
21 | ||
22 | #ifndef OPENSSL_EC_PRIVATE_KEY_H_ | |
23 | #define OPENSSL_EC_PRIVATE_KEY_H_ | |
24 | ||
4a6f97d0 TB |
25 | #include <openssl/evp.h> |
26 | ||
30c06407 | 27 | #include <credentials/builder.h> |
ea0823df TB |
28 | #include <credentials/keys/private_key.h> |
29 | ||
30 | typedef struct openssl_ec_private_key_t openssl_ec_private_key_t; | |
31 | ||
32 | /** | |
33 | * private_key_t implementation of ECDSA using OpenSSL. | |
34 | */ | |
35 | struct openssl_ec_private_key_t { | |
36 | ||
37 | /** | |
38 | * Implements private_key_t interface | |
39 | */ | |
57202484 | 40 | private_key_t key; |
ea0823df TB |
41 | }; |
42 | ||
43 | /** | |
30c06407 MW |
44 | * Generate a ECDSA private key using OpenSSL. |
45 | * | |
46 | * Accepts the BUILD_KEY_SIZE argument. | |
47 | * | |
48 | * @param type type of the key, must be KEY_ECDSA | |
49 | * @param args builder_part_t argument list | |
50 | * @return generated key, NULL on failure | |
51 | */ | |
52 | openssl_ec_private_key_t *openssl_ec_private_key_gen(key_type_t type, | |
53 | va_list args); | |
54 | ||
55 | /** | |
56 | * Load a ECDSA private key using OpenSSL. | |
57 | * | |
58 | * Accepts a BUILD_BLOB_ASN1_DER argument. | |
ea0823df TB |
59 | * |
60 | * @param type type of the key, must be KEY_ECDSA | |
30c06407 MW |
61 | * @param args builder_part_t argument list |
62 | * @return loaded key, NULL on failure | |
ea0823df | 63 | */ |
30c06407 MW |
64 | openssl_ec_private_key_t *openssl_ec_private_key_load(key_type_t type, |
65 | va_list args); | |
ea0823df | 66 | |
4a6f97d0 TB |
67 | /** |
68 | * Wrap an EVP_PKEY object of type EVP_PKEY_EC | |
69 | * | |
70 | * @param key EVP_PKEY_EC key object (adopted) | |
b2266280 | 71 | * @param engine whether the key was loaded via an engine |
4a6f97d0 TB |
72 | * @return loaded key, NULL on failure |
73 | */ | |
b2266280 | 74 | private_key_t *openssl_ec_private_key_create(EVP_PKEY *key, bool engine); |
4a6f97d0 | 75 | |
1490ff4d | 76 | #endif /** OPENSSL_EC_PRIVATE_KEY_H_ @}*/ |