rsa.h 949 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright 2014-2022 The GmSSL Project. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the License); you may
  5. * not use this file except in compliance with the License.
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. */
  9. #ifndef GMSSL_RSA_H
  10. #define GMSSL_RSA_H
  11. #include <stdio.h>
  12. #include <string.h>
  13. #include <stdint.h>
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. /*
  18. RSAPublicKey ::= SEQUENCE {
  19. modulus INTEGER, -- n
  20. publicExponent INTEGER -- e
  21. }
  22. RSAPrivateKey ::= SEQUENCE {
  23. version INTEGER, -- 0
  24. modulus INTEGER, -- n
  25. publicExponent INTEGER, -- e
  26. privateExponent INTEGER, -- d
  27. prime1 INTEGER, -- p
  28. prime2 INTEGER, -- q
  29. exponent1 INTEGER, -- d mod (p-1)
  30. exponent2 INTEGER, -- d mod (q-1)
  31. coefficient INTEGER -- q^-1 mod p
  32. }
  33. */
  34. int rsa_public_key_print(FILE *fp, int fmt, int ind, const char *label, const uint8_t *d, size_t dlen);
  35. #ifdef __cplusplus
  36. }
  37. #endif
  38. #endif