/**
* \file rsa_wrapper.h
* \brief RSA wrapper for CryptoCore/own crypto.
* \author Roman Pasechnik (r.pasechnik@samsung.com)
* \version 0.1
* \date Created Jan 14, 2014
* \par In Samsung Ukraine R&D Center (SURC) under a contract between
* \par LLC "Samsung Electronics Ukraine Company" (Kiev, Ukraine) and
* \par "Samsung Elecrtronics Co", Ltd (Seoul, Republic of Korea)
* \par Copyright: (c) Samsung Electronics Co, Ltd 2014. All rights reserved.
**/

#ifndef WRAPPER_RSA_H
#define WRAPPER_RSA_H

#ifdef USE_CRYPTOCORE
#include "openssl/rsa/rsa.h"
#else
#include "rsa/rsa.h"
#endif

int bn_dump(const BIGNUM *n, unsigned char *output, int size);

unsigned long mldap_rsa_get_exponent(void);

void mldap_rsa_set_exponent(unsigned long exp);

RSA* mldap_RSA_new(void);

void mldap_RSA_free(RSA *r);

int mldap_rsa_gen_key(RSA *rsa, int bits, unsigned long e);

int mldap_rsa_pkcs1_sign(RSA *rsa, int hash_id, int hashlen, unsigned char *hash, unsigned char *sig);
int mldap_rsa_pkcs1_verify(RSA *rsa, int hash_id, int hashlen, unsigned char *hash, unsigned char *sig);
int mldap_rsa_check_keypair(RSA *rsa);

#endif /* WRAPPER_RSA_H */
