crypto_format.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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-2018, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. #ifndef TOR_CRYPTO_FORMAT_H
  7. #define TOR_CRYPTO_FORMAT_H
  8. #include "lib/testsupport/testsupport.h"
  9. #include "lib/cc/torint.h"
  10. #include "lib/defs/x25519_sizes.h"
  11. struct ed25519_public_key_t;
  12. struct ed25519_signature_t;
  13. int crypto_write_tagged_contents_to_file(const char *fname,
  14. const char *typestring,
  15. const char *tag,
  16. const uint8_t *data,
  17. size_t datalen);
  18. ssize_t crypto_read_tagged_contents_from_file(const char *fname,
  19. const char *typestring,
  20. char **tag_out,
  21. uint8_t *data_out,
  22. ssize_t data_out_len);
  23. int ed25519_public_from_base64(struct ed25519_public_key_t *pkey,
  24. const char *input);
  25. int ed25519_public_to_base64(char *output,
  26. const struct ed25519_public_key_t *pkey);
  27. const char *ed25519_fmt(const struct ed25519_public_key_t *pkey);
  28. int ed25519_signature_from_base64(struct ed25519_signature_t *sig,
  29. const char *input);
  30. int ed25519_signature_to_base64(char *output,
  31. const struct 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 /* !defined(TOR_CRYPTO_FORMAT_H) */