2
0

rsaglue.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (c) 1995 Colin Plumb. All rights reserved.
  3. * For licensing and other legal details, see the file legal.c.
  4. *
  5. * rsaglue.h - RSA encryption and decryption
  6. */
  7. #ifndef RSAGLUE_H
  8. #define RSAGLUE_H
  9. struct PubKey;
  10. struct SecKey;
  11. struct BigNum;
  12. #include "usuals.h"
  13. #define RSAGLUE_NOMEM -1 /* Ran out of memory */
  14. #define RSAGLUE_TOOBIG -2 /* Key too big (currently impossible) */
  15. #define RSAGLUE_TOOSMALL -3 /* Key too small (encryption only) */
  16. #define RSAGLUE_CORRUPT -4 /* Decrypted data corrupt (decrypt only) */
  17. #define RSAGLUE_UNRECOG -5 /* Unrecognized data (decrypt only) */
  18. /* Declarations */
  19. int rsaKeyTooBig(struct PubKey const *pub, struct SecKey const *sec);
  20. int
  21. rsaPublicEncrypt(struct BigNum *bn, byte const *in, unsigned len,
  22. struct PubKey const *pub);
  23. int
  24. rsaPrivateEncrypt(struct BigNum *bn, byte const *in, unsigned len,
  25. struct PubKey const *pub, struct SecKey const *sec);
  26. int
  27. rsaPublicDecrypt(byte *buf, unsigned len, struct BigNum *bn,
  28. struct PubKey const *pub);
  29. int
  30. rsaPrivateDecrypt(byte *buf, unsigned len, struct BigNum *bn,
  31. struct PubKey const *pub, struct SecKey const *sec);
  32. #endif /* !RSAGLUE_H */