loadkey.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* Copyright (c) 2001 Matej Pfajfar.
  2. * Copyright (c) 2001-2004, Roger Dingledine.
  3. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
  4. * Copyright (c) 2007-2019, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. /**
  7. * \file loadkey.h
  8. * \brief Header file for loadkey.c
  9. **/
  10. #ifndef TOR_LOADKEY_H
  11. #define TOR_LOADKEY_H
  12. #include "lib/crypt_ops/crypto_ed25519.h"
  13. crypto_pk_t *init_key_from_file(const char *fname, int generate,
  14. int severity, bool *created_out);
  15. #define INIT_ED_KEY_CREATE (1u<<0)
  16. #define INIT_ED_KEY_REPLACE (1u<<1)
  17. #define INIT_ED_KEY_SPLIT (1u<<2)
  18. #define INIT_ED_KEY_MISSING_SECRET_OK (1u<<3)
  19. #define INIT_ED_KEY_NEEDCERT (1u<<4)
  20. #define INIT_ED_KEY_EXTRA_STRONG (1u<<5)
  21. #define INIT_ED_KEY_INCLUDE_SIGNING_KEY_IN_CERT (1u<<6)
  22. #define INIT_ED_KEY_OMIT_SECRET (1u<<7)
  23. #define INIT_ED_KEY_TRY_ENCRYPTED (1u<<8)
  24. #define INIT_ED_KEY_NO_REPAIR (1u<<9)
  25. #define INIT_ED_KEY_SUGGEST_KEYGEN (1u<<10)
  26. #define INIT_ED_KEY_OFFLINE_SECRET (1u<<11)
  27. #define INIT_ED_KEY_EXPLICIT_FNAME (1u<<12)
  28. struct tor_cert_st;
  29. ed25519_keypair_t *ed_key_init_from_file(const char *fname, uint32_t flags,
  30. int severity,
  31. const ed25519_keypair_t *signing_key,
  32. time_t now,
  33. time_t lifetime,
  34. uint8_t cert_type,
  35. struct tor_cert_st **cert_out,
  36. const or_options_t *options);
  37. ed25519_keypair_t *ed_key_new(const ed25519_keypair_t *signing_key,
  38. uint32_t flags,
  39. time_t now,
  40. time_t lifetime,
  41. uint8_t cert_type,
  42. struct tor_cert_st **cert_out);
  43. int read_encrypted_secret_key(ed25519_secret_key_t *out,
  44. const char *fname);
  45. int write_encrypted_secret_key(const ed25519_secret_key_t *out,
  46. const char *fname);
  47. #endif