Documentation ¶
Index ¶
Constants ¶
View Source
const ( // NonceBytes is the length of nacl nonce. NonceBytes = 24 // EphemeralPublicKeyBytes is the 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 FromPrivKey ¶
func FromPrivKey(sk crypto.PrivKey) (*DecryptionKey, error)
FromPrivKey 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) MarshalBinary ¶
func (k *DecryptionKey) MarshalBinary() ([]byte, error)
MarshalBinary implements BinaryMarshaler.
type EncryptionKey ¶
type EncryptionKey struct {
// contains filtered or unexported fields
}
EncryptionKey is a public key wrapper that can perform encryption.
func FromPubKey ¶
func FromPubKey(pk crypto.PubKey) (*EncryptionKey, error)
FromPubKey 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) MarshalBinary ¶
func (k *EncryptionKey) MarshalBinary() ([]byte, error)
MarshalBinary implements BinaryMarshaler.
Click to show internal directories.
Click to hide internal directories.