keys.h 759 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright (c) 1995 Colin Plumb. All rights reserved.
  3. * For licensing and other legal details, see the file legal.c.
  4. */
  5. #ifndef KEYS_H
  6. #define KEYS_H
  7. /*
  8. * Structures for keys.
  9. */
  10. #include "bn.h"
  11. /* A structure to hold a public key */
  12. struct PubKey {
  13. struct BigNum n; /* The public modulus */
  14. struct BigNum e; /* The public exponent */
  15. };
  16. /* A structure to hold a secret key */
  17. struct SecKey {
  18. struct BigNum d; /* Decryption exponent */
  19. struct BigNum p; /* The smaller factor of n */
  20. struct BigNum q; /* The larger factor of n */
  21. struct BigNum u; /* 1/p (mod q) */
  22. };
  23. void pubKeyBegin(struct PubKey *pub);
  24. void pubKeyEnd(struct PubKey *pub);
  25. void secKeyBegin(struct SecKey *sec);
  26. void secKeyEnd(struct SecKey *sec);
  27. #endif /* KEYS_H */