Rust utility crate for parsing, encoding and generating x25519 keys used by WireGuard

Overview

WireGuard Keys

This is a utility crate for parsing, encoding and generating x25519 keys that are used by WireGuard. It exports custom types that can be used to store any of these keys, and it has an integration with serde to be able to serialize and deserialize them.

You can use this crate if you want to generate private keys for use with WireGuard, or if you want to encode and parse WireGuard keys (such as reading them from JSON documents).

Resources:

Example code

Generating private and public x25519 keys, and preshared keys for use with WireGuard.

// generate private key
let privkey = Privkey::generate();

// generate public key from private key
let pubkey: Pubkey = privkey.pubkey();

// generate secret
let secret = Secret::generate();

Encoding and parsing keys.

// can export.
Privkey::generate().to_string() // => "INBg4AAN7tRyXTyXMEYFP93oBWfRYvH5oty03+H32nY="

// can parse
let privkey = Privkey::from_str("INBg4AAN7tRyXTyXMEYFP93oBWfRYvH5oty03+H32nY=").unwrap();

Usage

To use this crate, simply add this line to your dependencies section in your crate configuration:

wireguard-keys = "0.1"

Optional features

These optional features can be enabled:

  • serde: serialization and deserialization capabilities (enabled by default).
  • hex: convert to and from hex (enabled by default).
  • base64: convert to and from base64 (enabled by default).
  • base32: convert to and from base32.
  • rocket: ability to parse WireGuard keys from HTTP requests in Rocket.
  • schema: ability to generate JSON schemas from the types.
You might also like...
Listen to bluetooth headphone keys (Linux only)

What Take action when you use your bluetooth headphone to indicate pause, play, next or previous. For Linux only. Why You can bind global keys to XF86

Rust library for A-law and μ-law (mu-law) audio encoding.

law-encoder ⚖️️‍️law-encoder👨‍⚖ is a Rust library for A-law and μ-law (mu-law) audio encoding. These encoding schemes are defined in ITU-T standards

A Rust library for parsing the SOME/IP network protocol (without payload interpretation).

someip_parse A Rust library for parsing the SOME/IP network protocol (without payload interpretation). Usage Add the following to your Cargo.toml: [de

TCP is so widely used, however QUIC may have a better performance.

TCP is so widely used, however QUIC may have a better performance. For softwares which use protocols built on TCP, this program helps them take FULL advantage of QUIC.

axum-server is a hyper server implementation designed to be used with axum framework.

axum-server axum-server is a hyper server implementation designed to be used with axum framework. Features Conveniently bind to any number of addresse

A simple ping utility written in Rust, that is focused on being size efficient and fast.
A simple ping utility written in Rust, that is focused on being size efficient and fast.

MeowPing MeowPing is a command-line utility for testing network connectivity using ICMP echo requests or TCP connections. It provides similar function

A prettier lightweight colored ping utility written in Rust

rustyping A prettier lightweight colored ping utility written in Rust. Installation There are three installation options: From the releases page From

Utility for working with reverse DNS

RDNS RDNS is a small Rust CLI utility for performing single and bulk reverse DNS (PTR) lookups. Usage RDNS 0.1.0 Joe Banks [email protected] Utilities for

Simple utility to ping a TCP port.

TcpPing Simple utility to ping a TCP port. Example tcpping 1.1.1.1 53 -b en0 -i 1 -t 4 Connected to 1.1.1.1:53 in 21 ms Connected to 1.1.1.1:53 in 3

Owner
Fractal Networks
Fractal Networks
A private network system that uses WireGuard under the hood.

innernet A private network system that uses WireGuard under the hood. See the announcement blog post for a longer-winded explanation. innernet is simi

Tonari, Inc 4.1k Dec 29, 2022
A cross-platform, user-space WireGuard port-forwarder that requires no system network configurations.

Cross-platform, user-space WireGuard port-forwarder that requires no system network configurations.

Aram Peres 629 Jan 4, 2023
A Prometheus exporter for WireGuard

wireguard_exporter An asynchronous Prometheus exporter for wireguard wireguard_exporter runs wg show [..] and scrapes the output to build Prometheus m

Kevin K. 15 Dec 29, 2022
A WireGuard UWP VPN plugin.

WireGuard UWP A Universal Windows Platform (UWP) VPN Plug-in for WireGuard® written in Rust. Windows provides a plug-in based model for adding 3rd-par

Luqman Aden 92 Dec 13, 2022
WireGuard front for mitmproxy (WIP)

mitmguard work-in-progress WireGuard front for mitmproxy Architecture DONE multi-threaded / asynchronous WireGuard server using tokio: one worker thre

Fabio Valentini 23 Jan 5, 2023
WireGuard frontend for mitmproxy (WIP)

mitmproxy_wireguard Transparently proxy any device that can be configured as a WireGuard client! Work-In-Progress. Architecture DONE multi-threaded /

Fabio Valentini 20 Dec 29, 2022
WireGuard gateway with SNI for portable connectivity.

Gateway This is a daemon that controls gateway servers. Gateway servers are servers that fulfil three major purposes: facilitating connectivity betwee

Fractal Networks 5 Aug 9, 2022
Rosenpass is a formally verified, post-quantum secure VPN that uses WireGuard to transport the actual data.

Rosenpass README This repository contains A description of the Rosenpass protocol The reference implementation of the protocol – the rosenpass tool A

Rosenpass 597 Mar 19, 2023
User-space Wireguard gateway allowing sharing network connection from environment where usual routing rules are inaccessible.

wgslirpy A command line tool (and a Rust library) for accepting incoming connections within a Wireguard link and routing them to external network usin

Vitaly Shukela 4 Aug 21, 2023
A crate for parsing HTTP rate limit headers as per the IETF draft

rate-limits A crate for parsing HTTP rate limit headers as per the IETF draft. Inofficial implementations like the Github rate limit headers are also

Matthias 3 Jul 9, 2022