Return to openssl_rsa_private_key.h CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / strongswan / src / libstrongswan / plugins / openssl |
1.1 misho 1: /* 2: * Copyright (C) 2008-2016 Tobias Brunner 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 openssl_rsa_private_key openssl_rsa_private_key 18: * @{ @ingroup openssl_p 19: */ 20: 21: #ifndef OPENSSL_RSA_PRIVATE_KEY_H_ 22: #define OPENSSL_RSA_PRIVATE_KEY_H_ 23: 24: #include <openssl/evp.h> 25: 26: #include <credentials/builder.h> 27: #include <credentials/keys/private_key.h> 28: 29: typedef struct openssl_rsa_private_key_t openssl_rsa_private_key_t; 30: 31: /** 32: * private_key_t implementation of RSA algorithm using OpenSSL. 33: */ 34: struct openssl_rsa_private_key_t { 35: 36: /** 37: * Implements private_key_t interface 38: */ 39: private_key_t key; 40: }; 41: 42: /** 43: * Generate a RSA private key using OpenSSL. 44: * 45: * Accepts the BUILD_KEY_SIZE argument. 46: * 47: * @param type type of the key, must be KEY_RSA 48: * @param args builder_part_t argument list 49: * @return generated key, NULL on failure 50: */ 51: openssl_rsa_private_key_t *openssl_rsa_private_key_gen(key_type_t type, 52: va_list args); 53: 54: /** 55: * Load a RSA private key using OpenSSL. 56: * 57: * Accepts a BUILD_BLOB_ASN1_DER argument. 58: * 59: * @param type type of the key, must be KEY_RSA 60: * @param args builder_part_t argument list 61: * @return loaded key, NULL on failure 62: */ 63: openssl_rsa_private_key_t *openssl_rsa_private_key_load(key_type_t type, 64: va_list args); 65: 66: /** 67: * Wrap an EVP_PKEY object of type EVP_PKEY_RSA 68: * 69: * @param key EVP_PKEY_RSA key object (adopted) 70: * @param engine whether the key was loaded via an engine 71: * @return loaded key, NULL on failure 72: */ 73: private_key_t *openssl_rsa_private_key_create(EVP_PKEY *key, bool engine); 74: 75: /** 76: * Connect to a RSA private key on a smartcard. 77: * 78: * Accepts the BUILD_SMARTCARD_KEYID and the BUILD_SMARTCARD_PIN 79: * arguments. 80: * 81: * @param type type of the key, must be KEY_RSA 82: * @param args builder_part_t argument list 83: * @return loaded key, NULL on failure 84: */ 85: openssl_rsa_private_key_t *openssl_rsa_private_key_connect(key_type_t type, 86: va_list args); 87: 88: #endif /** OPENSSL_RSA_PRIVATE_KEY_H_ @}*/