Documentation ¶
Overview ¶
Package naclwrapper implements easy to use NaCL encryption/decryption wrappers including binary packing/unpacking
Index ¶
- Constants
- Variables
- func Decrypt(data []byte, rpubkey, rprivkey []byte) ([]byte, error)
- func DecryptPack(data []byte, rpubkey, rprivkey []byte) ([]byte, error)
- func Encrypt(data []byte, rpubkey, spubkey, sprivkey []byte) ([]byte, error)
- func EncryptPack(data []byte, rpubkey, spubkey, sprivkey []byte) ([]byte, error)
- type NaCLKeyPair
Constants ¶
View Source
const ( // RecipientPublicKey is the field marker for the recipient's public key RecipientPublicKey = iota + 1 // SenderPublicKey is the field marker for the senders's public key SenderPublicKey // Nonce is the field marker for the NaCL nonce Nonce // NaCLBox is the field marker for the NaCL encrypted message NaCLBox )
Variables ¶
View Source
var ( // ErrMissingKey is returned when neither sender nor recipient keys are given ErrMissingKey = errors.New("nacl wrapper: either sender or recipient key must be given") // ErrMissingPrivate is returned when no private key has been given ErrMissingPrivate = errors.New("nacl wrapper: no private key given") // ErrDataShort is returned if the packet could not containe a message ErrDataShort = errors.New("nacl wrapper: data short") // ErrNotRecipient is returned if the packet is not addressed to the private key ErrNotRecipient = errors.New("nacl wrapper: not addressed to recipient") // ErrDecryptFailed is returned if the packet could not been decrypted ErrDecryptFailed = errors.New("nacl wrapper: could not decrypt") // ErrFieldMissing is returned if the packed message is missing a field ErrFieldMissing = errors.New("nacl wrapper: missing field") // ErrEncryptToSelf is returned if both keys are the same ErrEncryptToSelf = errors.New("nacl wrapper: will not encrypt to self") )
Functions ¶
func DecryptPack ¶
DecryptPack decrypts an encrypted bytepack
Types ¶
type NaCLKeyPair ¶
NaCLKeyPair contains a NaCL key
Click to show internal directories.
Click to hide internal directories.