31 lines
630 B
C
31 lines
630 B
C
|
#ifndef KEYS_H
|
||
|
#define KEYS_H
|
||
|
|
||
|
/*
|
||
|
* Structures for keys.
|
||
|
*/
|
||
|
|
||
|
#include "bn.h"
|
||
|
|
||
|
/* A structure to hold a public key */
|
||
|
struct PubKey {
|
||
|
struct BigNum n; /* The public modulus */
|
||
|
struct BigNum e; /* The public exponent */
|
||
|
};
|
||
|
|
||
|
/* A structure to hold a secret key */
|
||
|
struct SecKey {
|
||
|
struct BigNum d; /* Decryption exponent */
|
||
|
struct BigNum p; /* The smaller factor of n */
|
||
|
struct BigNum q; /* The larger factor of n */
|
||
|
struct BigNum u; /* 1/p (mod q) */
|
||
|
};
|
||
|
|
||
|
void pubKeyBegin(struct PubKey *pub);
|
||
|
void pubKeyEnd(struct PubKey *pub);
|
||
|
|
||
|
void secKeyBegin(struct SecKey *sec);
|
||
|
void secKeyEnd(struct SecKey *sec);
|
||
|
|
||
|
#endif /* KEYS_H */
|