crypto_format.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 crypto_format.h
  8. * \brief Header for crypto_format.c
  9. **/
  10. #ifndef TOR_CRYPTO_FORMAT_H
  11. #define TOR_CRYPTO_FORMAT_H
  12. #include "lib/testsupport/testsupport.h"
  13. #include "lib/cc/torint.h"
  14. #include "lib/defs/x25519_sizes.h"
  15. struct ed25519_public_key_t;
  16. struct ed25519_signature_t;
  17. int crypto_write_tagged_contents_to_file(const char *fname,
  18. const char *typestring,
  19. const char *tag,
  20. const uint8_t *data,
  21. size_t datalen);
  22. ssize_t crypto_read_tagged_contents_from_file(const char *fname,
  23. const char *typestring,
  24. char **tag_out,
  25. uint8_t *data_out,
  26. ssize_t data_out_len);
  27. int ed25519_public_from_base64(struct ed25519_public_key_t *pkey,
  28. const char *input);
  29. int ed25519_public_to_base64(char *output,
  30. const struct ed25519_public_key_t *pkey);
  31. const char *ed25519_fmt(const struct ed25519_public_key_t *pkey);
  32. int ed25519_signature_from_base64(struct ed25519_signature_t *sig,
  33. const char *input);
  34. int ed25519_signature_to_base64(char *output,
  35. const struct ed25519_signature_t *sig);
  36. int digest_to_base64(char *d64, const char *digest);
  37. int digest_from_base64(char *digest, const char *d64);
  38. int digest256_to_base64(char *d64, const char *digest);
  39. int digest256_from_base64(char *digest, const char *d64);
  40. #endif /* !defined(TOR_CRYPTO_FORMAT_H) */