cryptography

package module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2024 License: BSD-3-Clause Imports: 7 Imported by: 1

README

Cryptography lib for NEUdp services

Installation

go get gitlab.com/neudp/lib/cryptography

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateEd25519KeyPair

func GenerateEd25519KeyPair() (PublicKey, PrivateKey, error)

func VerifyEd25519

func VerifyEd25519(key PublicKey, signature Signature, payload Payload) bool

func VerifyHash

func VerifyHash(key MacKey, algo HashAlgo, hashValue HashValue, payload Payload) bool

VerifyHash checks if the given signature is the correct hash of the data using the provided key

Types

type HashAlgo

type HashAlgo func(MacKey, Payload) HashValue

type HashValue

type HashValue []byte

func Blake2b256

func Blake2b256(key MacKey, payload Payload) HashValue

Blake2b256 calculates the BLAKE2b-256 hash of the given data If a key is provided, it is used as the HMAC key

func Sha256

func Sha256(key MacKey, payload Payload) HashValue

Sha256 calculates the SHA-256 hash of the given data If a key is provided, it is used as the HMAC key

type MacKey

type MacKey []byte

type Payload

type Payload []byte

type PrivateKey

type PrivateKey []byte

func DecodeEd25519PrivateKey added in v0.1.2

func DecodeEd25519PrivateKey(key PrivatePem) (PrivateKey, error)

type PrivatePem added in v0.1.2

type PrivatePem []byte

func EncodeEd25519PrivateKey added in v0.1.2

func EncodeEd25519PrivateKey(key PrivateKey) (PrivatePem, error)

type PublicKey

type PublicKey []byte

func DecodeEd25519PublicKey added in v0.1.2

func DecodeEd25519PublicKey(key PublicPem) (PublicKey, error)

type PublicPem added in v0.1.2

type PublicPem []byte

func EncodeEd25519PublicKey added in v0.1.2

func EncodeEd25519PublicKey(key PublicKey) (PublicPem, error)

type Signature

type Signature []byte

func Ed25519

func Ed25519(key PrivateKey, payload Payload) Signature

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL