asymmetric

package
v0.0.0-...-31fc120 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Length of nacl nonce
	NonceBytes = 24

	// Length of nacl ephemeral public key
	EphemeralPublicKeyBytes = 32
)

Variables

View Source
var (
	// Nacl box decryption failed
	BoxDecryptionError = fmt.Errorf("failed to decrypt curve25519")
)

Functions

This section is empty.

Types

type DecryptionKey

type DecryptionKey struct {
	// contains filtered or unexported fields
}

DecryptionKey is a private key wrapper that can perform decryption.

func NewDecryptionKey

func NewDecryptionKey(sk ic.PrivKey) (*DecryptionKey, error)

NewDecryptionKey returns a key by parsing k into a private key.

func (*DecryptionKey) Decrypt

func (k *DecryptionKey) Decrypt(ciphertext []byte) ([]byte, error)

Decrypt ciphertext with a private key.

func (*DecryptionKey) Encrypt

func (k *DecryptionKey) Encrypt(plaintext []byte) ([]byte, error)

Encrypt bytes with a public key.

func (*DecryptionKey) Marshal

func (k *DecryptionKey) Marshal() ([]byte, error)

Marshal returns raw key bytes.

type EncryptionKey

type EncryptionKey struct {
	// contains filtered or unexported fields
}

EncryptionKey is a public key wrapper that can perform encryption.

func NewEncryptionKey

func NewEncryptionKey(pk ic.PubKey) (*EncryptionKey, error)

NewEncryptionKey returns a key by parsing k into a public key.

func (*EncryptionKey) Encrypt

func (k *EncryptionKey) Encrypt(plaintext []byte) ([]byte, error)

Encrypt bytes with a public key.

func (*EncryptionKey) Marshal

func (k *EncryptionKey) Marshal() ([]byte, error)

Marshal returns raw key bytes.

Jump to

Keyboard shortcuts

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