tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

crypto_format.h (1981B)


      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 */
      6 
      7 /**
      8 * \file crypto_format.h
      9 * \brief Header for crypto_format.c
     10 **/
     11 
     12 #ifndef TOR_CRYPTO_FORMAT_H
     13 #define TOR_CRYPTO_FORMAT_H
     14 
     15 #include "lib/testsupport/testsupport.h"
     16 #include "lib/cc/torint.h"
     17 #include "lib/defs/x25519_sizes.h"
     18 
     19 struct ed25519_public_key_t;
     20 struct ed25519_signature_t;
     21 
     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);
     27 
     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);
     33 
     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);
     39 
     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);
     44 
     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);
     49 
     50 #endif /* !defined(TOR_CRYPTO_FORMAT_H) */