hwnaclbox

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package hwnaclbox implements the NaCl box construction with hardware-backed private keys

This package provides alternative versions of the functions in golang.org/x/crypto/nacl/box which take an src.agwa.name/go-hwkey.ECDHer as the private key instead of a byte array. This lets you use hardware-backed private keys, such as the YubiKey (you'll need firmware 5.7.0 or higher).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(out, box []byte, nonce *[24]byte, peersPublicKey *[32]byte, privateKey hwkey.ECDHer) ([]byte, error)

Open authenticates and decrypts a box produced by golang.org/x/crypto/nacl/box.Seal and appends the message to out, which must not overlap box. The output will be golang.org/x/crypto/nacl/box.Overhead bytes smaller than box.

func OpenAnonymous

func OpenAnonymous(out, box []byte, privateKey hwkey.ECDHer) ([]byte, error)

OpenAnonymous authenticates and decrypts a box produced by golang.org/x/crypto/nacl/box.SealAnonymous and appends the message to out, which must not overlap box. The output will be golang.org/x/crypto/nacl/box.AnonymousOverhead bytes smaller than box.

func Precompute

func Precompute(sharedKey *[32]byte, peersPublicKey *[32]byte, privateKey hwkey.ECDHer) error

Precompute calculates the shared key between peersPublicKey and privateKey and writes it to sharedKey. The shared key can be used with golang.org/x/crypto/nacl/box.OpenAfterPrecomputation to speed up processing when using the same pair of keys repeatedly.

Types

This section is empty.

Jump to

Keyboard shortcuts

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