Module utils

Module utils 

Source
Expand description

Utility functions for the application.

This module provides various utility functions for generating keys, encrypting/decrypting data, and handling tunnels. It also includes functions for parsing tunnel definitions and handling bidirectional data transfer.

Functionsยง

decrypt
Decrypts the given ciphertext using the shared secret.
decrypt_in_place
Decrypts the data in place.
encrypt
Encrypts the given plaintext using the shared secret.
encrypt_into
Encrypts the data in place and appends the tag to the end of the buffer. The nonce is generated randomly.
generate_challenge
Generates a random challenge for a peer to sign.
generate_ephemeral_key_pair
Generates an ephemeral key pair for key exchange.
generate_key_pair
Generates a random alphanumeric string of the specified length.
generate_key_pair_from_key
Generates a key pair from a given private key.
generate_shared_secret
Derives a shared secret for encrypting and decrypting data.
handle_tcp_pump
Handles bidirectional data transfer between two streams.
handle_udp_pump
Handles bidirectional data transfer between a UDP socket and a TCP stream.
parse_tunnel_definition
Parses the tunnel definition from the given input string.
parse_tunnel_definitions
Parses a list of tunnel definitions from the given input strings.
random_string
Generates a random alphanumeric string of the specified length.
sign_challenge
Signs a challenge using the provided private key.
validate_signed_challenge
Validates a signed challenge using the provided public key.