Documentation ¶
Index ¶
- Constants
- func Decrypt(encryptedData []byte, sharedKey *[SharedKeySize]byte, nonce *[NonceSize]byte) ([]byte, error)
- func Encrypt(data []byte, sharedKey *[SharedKeySize]byte) ([]byte, *[NonceSize]byte, error)
- func GenerateKeyPair() (*[PublicKeySize]byte, *[SecretKeySize]byte, error)
- func GenerateNonce() (*[NonceSize]byte, error)
- func GeneratePingID() (uint64, error)
- func PrecomputeKey(publicKey *[PublicKeySize]byte, secretKey *[SecretKeySize]byte) *[SharedKeySize]byte
Constants ¶
View Source
const ( // PublicKeySize represents the size of a public key in bytes. PublicKeySize = 32 // SecretKeySize represents the size of a secret key in bytes. SecretKeySize = 32 SharedKeySize = 32 // NonceSize represents the size of a nonce in bytes. NonceSize = 24 )
Variables ¶
This section is empty.
Functions ¶
func Decrypt ¶
func Decrypt(encryptedData []byte, sharedKey *[SharedKeySize]byte, nonce *[NonceSize]byte) ([]byte, error)
Decrypt uses a crypto_box_open_afternm-equivalent function to decrypt the given data.
func GenerateKeyPair ¶
func GenerateKeyPair() (*[PublicKeySize]byte, *[SecretKeySize]byte, error)
GenerateKeyPair generates a new curve25519 keypair.
func GenerateNonce ¶
GenerateNonce generates a random nonce.
func GeneratePingID ¶
GeneratePingID generates a new random ping ID.
func PrecomputeKey ¶
func PrecomputeKey(publicKey *[PublicKeySize]byte, secretKey *[SecretKeySize]byte) *[SharedKeySize]byte
PrecomputeKey calculates the shared key between the peer's publicKey and our own secret key.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.