security.h
Go to the documentation of this file.
1 /*!**********************************************************************
2  *
3  * @copyright Copyright (C) 2016 Siemens Aktiengesellschaft.\n
4  * All rights reserved.
5  *
6  *************************************************************************
7  *
8  * @file security.h
9  * @date Jun 27, 2016
10  * @brief Security module header file.
11  * *
12  * Inner security interface. Contains security related functions like hashing, public/private key generation.
13  * Implementation file might change depending on the platform and will be in security_XXX.c format.
14  *
15  ************************************************************************/
16 
17 #ifndef SECURITY_H_
18 #define SECURITY_H_
19 
20 #include "mcl/mcl_common.h"
21 
25 void security_initialize(void);
26 
30 E_MCL_ERROR_CODE security_hash_sha256(const mcl_uint8_t *data, mcl_size_t data_size, mcl_uint8_t **hash, mcl_size_t *hash_size);
31 
49 E_MCL_ERROR_CODE security_rsa_sign(char *rsa_key, char *data, mcl_size_t data_size, mcl_uint8_t **signature, mcl_size_t *signature_size);
50 
65 E_MCL_ERROR_CODE security_generate_rsa_key(char **public_key, char **private_key);
66 
80 E_MCL_ERROR_CODE security_rsa_get_modulus_and_exponent(char *public_key, char **modulus, char **exponent);
81 
94 
95 #endif //SECURITY_H_
Common module interface header file.
E_MCL_ERROR_CODE security_generate_random_bytes(unsigned char *buffer, mcl_size_t size)
To be used to generate random bytes.
E_MCL_ERROR_CODE
MCL Error code definitions. Every function returning an error code uses this enum values...
Definition: mcl_common.h:137
E_MCL_ERROR_CODE security_hash_sha256(const mcl_uint8_t *data, mcl_size_t data_size, mcl_uint8_t **hash, mcl_size_t *hash_size)
uint8_t mcl_uint8_t
Definition: mcl_common.h:43
E_MCL_ERROR_CODE security_rsa_get_modulus_and_exponent(char *public_key, char **modulus, char **exponent)
To be used to get the modulus (n) and public exponent (e) parameters of RSA key in Base64 format...
size_t mcl_size_t
Definition: mcl_common.h:38
void security_initialize(void)
E_MCL_ERROR_CODE security_rsa_sign(char *rsa_key, char *data, mcl_size_t data_size, mcl_uint8_t **signature, mcl_size_t *signature_size)
To be used to sign data with RSA key.
E_MCL_ERROR_CODE security_generate_rsa_key(char **public_key, char **private_key)
To be used to generate the RSA public/private keys.