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-2021, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
8 * \file crypto_format.h
9 * \brief Header for crypto_format.c
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
,
28 ssize_t
crypto_read_tagged_contents_from_file(const char *fname
,
29 const char *typestring
,
32 ssize_t data_out_len
);
34 int ed25519_public_from_base64(struct ed25519_public_key_t
*pkey
,
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
,
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) */