Documentation
¶
Overview ¶
Wrapper around golang.org/x/crypto/nacl/box for easy use with KeyLength-byte keys
Index ¶
- Constants
- func GenerateNonce() (*[NonceLength]byte, error)
- func Open(encrypted []byte, peersPublicKey, privateKey *[KeyLength]byte) ([]byte, error)
- func OpenAfterPrecomputation(encrypted []byte, sharedKey *[KeyLength]byte) ([]byte, error)
- func OpenAnonymous(encrypted []byte, publicKey, privateKey *[KeyLength]byte) ([]byte, error)
- func Precompute(sharedKey, peersPublicKey, privateKey *[KeyLength]byte)
- func Seal(message []byte, peersPublicKey, privateKey *[KeyLength]byte) ([]byte, error)
- func SealAfterPrecomputation(message []byte, sharedKey *[KeyLength]byte) ([]byte, error)
- func SealAnonymous(message []byte, publicKey *[KeyLength]byte) ([]byte, error)
- type BoxKey
Constants ¶
const ( KeyLength = 32 NonceLength = 24 )
Variables ¶
This section is empty.
Functions ¶
func GenerateNonce ¶
func GenerateNonce() (*[NonceLength]byte, error)
Generate random nonce to use with Seal*
func OpenAfterPrecomputation ¶
OpenAfterPrecomputation performs the same actions as Open, but takes a shared key as generated by Precompute.
func OpenAnonymous ¶
OpenAnonymous authenticates and decrypts a message produced by SealAnonymous
func Precompute ¶
Precompute calculates the shared key between peersPublicKey and privateKey and writes it to sharedKey. The shared key can be used with OpenAfterPrecomputation and SealAfterPrecomputation to speed up processing when using the same pair of keys repeatedly.
func SealAfterPrecomputation ¶
SealAfterPrecomputation performs the same actions as Seal, but takes a shared key as generated by Precompute.
Types ¶
type BoxKey ¶
func GenerateKey ¶
func GenerateKey() (publicKey, privateKey BoxKey)
GenerateKey generates a new public/private key pair suitable for use with Seal and Open
func (BoxKey) Decrypt ¶
Decrypt decrypts encrypted message using OpenAnonymous of nacl/box with PrivateKey and related PublicKey