X25519

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2019 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const NaclBoxNonceSize = 24
View Source
const PrivateKeySize = 32
View Source
const PublicKeySize = 32

Variables

This section is empty.

Functions

This section is empty.

Types

type NaclBoxNonce

type NaclBoxNonce [NaclBoxNonceSize]byte

NaclBoxNonce is a Nacl box nonce wrapper (24 bytes)

func (NaclBoxNonce) MarshalJSON

func (nbn NaclBoxNonce) MarshalJSON() ([]byte, error)

MarshalJSON returns the base64 value of a nacl box nonce.

func (*NaclBoxNonce) UnmarshalJSON

func (nbn *NaclBoxNonce) UnmarshalJSON(data []byte) error

UnmarshalJSON accepts a base64 value to load a nacl box nonce.

type PrivateKey

type PrivateKey [PrivateKeySize]byte

PrivateKey is an X25519 private key wrapper (32 bytes).

func NewPrivateKey

func NewPrivateKey(privateKeyBytes []byte) *PrivateKey

PrivateKey constructor.

func (*PrivateKey) Open

func (pk *PrivateKey) Open(encryptedMessage []byte, senderPublicKey *PublicKey, nonce *NaclBoxNonce) ([]byte, bool)

Open decrypts an encrypted message with the appropriate sender information.

func (*PrivateKey) Seal

func (pk *PrivateKey) Seal(message []byte, recipientPublicKey *PublicKey) (*NaclBoxNonce, []byte, error)

Seal encrypts a plain text message decipherable afterwards by the recipient public key.

type PublicKey

type PublicKey [PublicKeySize]byte

PublicKey is an X25519 public key wrapper (32 bytes).

func NewPublicKey

func NewPublicKey(publicKeyBytes []byte) *PublicKey

PublicKey constructor.

func (PublicKey) MarshalJSON

func (pk PublicKey) MarshalJSON() ([]byte, error)

MarshalJSON returns the base64 value of an X25519 public key.

func (*PublicKey) UnmarshalJSON

func (pk *PublicKey) UnmarshalJSON(data []byte) error

UnmarshalJSON accepts a base64 value to load an X25519 public key.

Jump to

Keyboard shortcuts

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