Merge branch 'maint-0.3.5' into maint-0.4.5
[tor.git] / src / lib / crypt_ops / crypto_format.h
blob91da137e1c25bceecf7b4a1e4cb9a14f24de4e5b
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-2020, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
7 /**
8 * \file crypto_format.h
9 * \brief Header for crypto_format.c
10 **/
12 #ifndef TOR_CRYPTO_FORMAT_H
13 #define TOR_CRYPTO_FORMAT_H
15 #include "lib/testsupport/testsupport.h"
16 #include "lib/cc/torint.h"
17 #include "lib/defs/x25519_sizes.h"
19 struct ed25519_public_key_t;
20 struct ed25519_signature_t;
22 int crypto_write_tagged_contents_to_file(const char *fname,
23 const char *typestring,
24 const char *tag,
25 const uint8_t *data,
26 size_t datalen);
28 ssize_t crypto_read_tagged_contents_from_file(const char *fname,
29 const char *typestring,
30 char **tag_out,
31 uint8_t *data_out,
32 ssize_t data_out_len);
34 int ed25519_public_from_base64(struct ed25519_public_key_t *pkey,
35 const char *input);
36 void ed25519_public_to_base64(char *output,
37 const struct ed25519_public_key_t *pkey);
38 const char *ed25519_fmt(const struct ed25519_public_key_t *pkey);
40 int ed25519_signature_from_base64(struct ed25519_signature_t *sig,
41 const char *input);
42 void ed25519_signature_to_base64(char *output,
43 const struct ed25519_signature_t *sig);
45 void digest_to_base64(char *d64, const char *digest);
46 int digest_from_base64(char *digest, const char *d64);
47 void digest256_to_base64(char *d64, const char *digest);
48 int digest256_from_base64(char *digest, const char *d64);
50 #endif /* !defined(TOR_CRYPTO_FORMAT_H) */