crypto_format.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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-2016, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. #ifndef TOR_CRYPTO_FORMAT_H
  7. #define TOR_CRYPTO_FORMAT_H
  8. #include "testsupport.h"
  9. #include "torint.h"
  10. #include "crypto_ed25519.h"
  11. int crypto_write_tagged_contents_to_file(const char *fname,
  12. const char *typestring,
  13. const char *tag,
  14. const uint8_t *data,
  15. size_t datalen);
  16. ssize_t crypto_read_tagged_contents_from_file(const char *fname,
  17. const char *typestring,
  18. char **tag_out,
  19. uint8_t *data_out,
  20. ssize_t data_out_len);
  21. #define ED25519_BASE64_LEN 43
  22. int ed25519_public_from_base64(ed25519_public_key_t *pkey,
  23. const char *input);
  24. int ed25519_public_to_base64(char *output,
  25. const ed25519_public_key_t *pkey);
  26. /* XXXX move these to crypto_format.h */
  27. #define ED25519_SIG_BASE64_LEN 86
  28. int ed25519_signature_from_base64(ed25519_signature_t *sig,
  29. const char *input);
  30. int ed25519_signature_to_base64(char *output,
  31. const ed25519_signature_t *sig);
  32. int digest_to_base64(char *d64, const char *digest);
  33. int digest_from_base64(char *digest, const char *d64);
  34. int digest256_to_base64(char *d64, const char *digest);
  35. int digest256_from_base64(char *digest, const char *d64);
  36. #endif