Donatien Garnier / MiniTLS-GPL

Dependents:   MiniTLS-HTTPS-Example

Committer:
MiniTLS
Date:
Fri Jun 06 10:49:02 2014 +0000
Revision:
0:35aa5be3b78d
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MiniTLS 0:35aa5be3b78d 1 /*
MiniTLS 0:35aa5be3b78d 2 MuTLS - A super trimmed down TLS/SSL Library for embedded devices
MiniTLS 0:35aa5be3b78d 3 Author: Donatien Garnier
MiniTLS 0:35aa5be3b78d 4 Copyright (C) 2013-2014 AppNearMe Ltd
MiniTLS 0:35aa5be3b78d 5
MiniTLS 0:35aa5be3b78d 6 This program is free software; you can redistribute it and/or
MiniTLS 0:35aa5be3b78d 7 modify it under the terms of the GNU General Public License
MiniTLS 0:35aa5be3b78d 8 as published by the Free Software Foundation; either version 2
MiniTLS 0:35aa5be3b78d 9 of the License, or (at your option) any later version.
MiniTLS 0:35aa5be3b78d 10
MiniTLS 0:35aa5be3b78d 11 This program is distributed in the hope that it will be useful,
MiniTLS 0:35aa5be3b78d 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
MiniTLS 0:35aa5be3b78d 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
MiniTLS 0:35aa5be3b78d 14 GNU General Public License for more details.
MiniTLS 0:35aa5be3b78d 15
MiniTLS 0:35aa5be3b78d 16 You should have received a copy of the GNU General Public License
MiniTLS 0:35aa5be3b78d 17 along with this program; if not, write to the Free Software
MiniTLS 0:35aa5be3b78d 18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
MiniTLS 0:35aa5be3b78d 19 *//**
MiniTLS 0:35aa5be3b78d 20 * \file crypto_rsa.h
MiniTLS 0:35aa5be3b78d 21 * \copyright Copyright (c) AppNearMe Ltd 2014
MiniTLS 0:35aa5be3b78d 22 * \author Donatien Garnier
MiniTLS 0:35aa5be3b78d 23 */
MiniTLS 0:35aa5be3b78d 24
MiniTLS 0:35aa5be3b78d 25 //This module has been adapted from libtomcrypt (http://libtom.org/)
MiniTLS 0:35aa5be3b78d 26
MiniTLS 0:35aa5be3b78d 27 #ifndef CRYPTO_RSA_H_
MiniTLS 0:35aa5be3b78d 28 #define CRYPTO_RSA_H_
MiniTLS 0:35aa5be3b78d 29
MiniTLS 0:35aa5be3b78d 30 #ifdef __cplusplus
MiniTLS 0:35aa5be3b78d 31 extern "C" {
MiniTLS 0:35aa5be3b78d 32 #endif
MiniTLS 0:35aa5be3b78d 33
MiniTLS 0:35aa5be3b78d 34 #include "core/fwk.h"
MiniTLS 0:35aa5be3b78d 35 #include "inc/mutls_errors.h"
MiniTLS 0:35aa5be3b78d 36 #include "inc/mutls_config.h"
MiniTLS 0:35aa5be3b78d 37 #include "crypto_prng.h"
MiniTLS 0:35aa5be3b78d 38 #include "crypto_math.h"
MiniTLS 0:35aa5be3b78d 39
MiniTLS 0:35aa5be3b78d 40 typedef struct __crypto_rsa_public_key
MiniTLS 0:35aa5be3b78d 41 {
MiniTLS 0:35aa5be3b78d 42 fp_int N;
MiniTLS 0:35aa5be3b78d 43 fp_int e;
MiniTLS 0:35aa5be3b78d 44 } crypto_rsa_public_key_t;
MiniTLS 0:35aa5be3b78d 45
MiniTLS 0:35aa5be3b78d 46 mutls_err_t crypto_rsa_pkcs1_import(crypto_rsa_public_key_t* key, const uint8_t* pkcs1, size_t size);
MiniTLS 0:35aa5be3b78d 47 mutls_err_t crypto_rsa_encrypt(const crypto_rsa_public_key_t* public_key,
MiniTLS 0:35aa5be3b78d 48 uint8_t* plaintext, size_t plaintext_size,
MiniTLS 0:35aa5be3b78d 49 uint8_t* secret, size_t max_secret_size, size_t* secret_size, crypto_prng_t* prng);
MiniTLS 0:35aa5be3b78d 50
MiniTLS 0:35aa5be3b78d 51 #ifdef __cplusplus
MiniTLS 0:35aa5be3b78d 52 }
MiniTLS 0:35aa5be3b78d 53 #endif
MiniTLS 0:35aa5be3b78d 54
MiniTLS 0:35aa5be3b78d 55 #endif /* CRYPTO_RSA_H_ */