This repository has been archived on 2024-01-23. You can view files and clone it, but cannot push or open issues or pull requests.
2017-01-10 06:36:19 +01:00
|
|
|
/* Copyright (C) 2015-2017 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved. */
|
2015-06-05 15:58:00 +02:00
|
|
|
|
2017-05-15 23:24:48 +02:00
|
|
|
#ifndef ENCODING_H
|
|
|
|
#define ENCODING_H
|
2015-06-05 15:58:00 +02:00
|
|
|
|
2017-04-16 01:20:43 +02:00
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "../uapi.h"
|
2015-06-05 15:58:00 +02:00
|
|
|
|
2017-04-16 01:20:43 +02:00
|
|
|
#define WG_KEY_LEN_BASE64 ((((WG_KEY_LEN) + 2) / 3) * 4 + 1)
|
2017-05-15 23:24:48 +02:00
|
|
|
#define WG_KEY_LEN_HEX (WG_KEY_LEN * 2 + 1)
|
2015-06-05 15:58:00 +02:00
|
|
|
|
2017-04-16 01:20:43 +02:00
|
|
|
void key_to_base64(char base64[static WG_KEY_LEN_BASE64], const uint8_t key[static WG_KEY_LEN]);
|
|
|
|
bool key_from_base64(uint8_t key[static WG_KEY_LEN], const char *base64);
|
2015-06-05 15:58:00 +02:00
|
|
|
|
2017-05-15 23:24:48 +02:00
|
|
|
void key_to_hex(char hex[static WG_KEY_LEN_HEX], const uint8_t key[static WG_KEY_LEN]);
|
|
|
|
bool key_from_hex(uint8_t key[static WG_KEY_LEN], const char *hex);
|
|
|
|
|
2015-06-05 15:58:00 +02:00
|
|
|
#endif
|