c-libp2p/include/libp2p/crypto/rsa.h

43 lines
895 B
C
Raw Normal View History

2016-11-03 16:15:18 +00:00
//
// rsa.h
// c-libp2p
//
// Created by John Jones on 11/3/16.
// Copyright © 2016 JMJAtlanta. All rights reserved.
//
#ifndef rsa_h
#define rsa_h
#include <stddef.h>
2016-11-03 16:15:18 +00:00
struct RsaPrivateKey {
2016-11-09 16:22:25 +00:00
unsigned long long QP;
unsigned long long DQ;
unsigned long long DP;
unsigned long long Q;
unsigned long long P;
unsigned long long D;
unsigned long long E;
unsigned long long N;
char* der;
size_t der_length;
2016-11-03 16:15:18 +00:00
};
/**
* generate a new private key
* @param private_key the new private key
* @param num_bits_for_keypair the size of the key (1024 minimum)
* @returns true(1) on success
*/
int crypto_rsa_generate_keypair(struct RsaPrivateKey* private_key, unsigned long num_bits_for_keypair);
/***
* Free resources used by RsaPrivateKey
* @param private_key the resources
* @returns 0
2016-11-07 20:11:58 +00:00
*/
int crypto_rsa_rsa_private_key_free(struct RsaPrivateKey* private_key);
2016-11-03 16:15:18 +00:00
#endif /* rsa_h */