Documentation ¶
Overview ¶
Package cryptoutil provides utility functions for cryptographic operations. It is the consumer's responsibility to ensure that inputs are reasonably sized so as to avoid memory exhaustion attacks.
Index ¶
- func DecryptSymmetricAESGCM(encryptedMsg []byte, secretKey *[32]byte) ([]byte, error)
- func DecryptSymmetricXChaCha20Poly1305(encryptedMsg []byte, secretKey *[32]byte) ([]byte, error)
- func EncryptSymmetricAESGCM(msg []byte, secretKey *[32]byte) ([]byte, error)
- func EncryptSymmetricXChaCha20Poly1305(msg []byte, secretKey *[32]byte) ([]byte, error)
- func Sha256Hash(msg []byte) []byte
- func SignSymmetric(msg []byte, secretKey *[32]byte) ([]byte, error)
- func VerifyAndReadAsymmetric(signedMsg []byte, publicKey *[32]byte) ([]byte, error)
- func VerifyAndReadAsymmetricBase64(signedMsg Base64, publicKey Base64) ([]byte, error)
- func VerifyAndReadSymmetric(signedMsg []byte, secretKey *[32]byte) ([]byte, error)
- type Base64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecryptSymmetricAESGCM ¶ added in v0.0.68
DecryptSymmetricAESGCM decrypts a message using AES-256-GCM.
func DecryptSymmetricXChaCha20Poly1305 ¶ added in v0.0.68
DecryptSymmetricXChaCha20Poly1305 decrypts a message using XChaCha20-Poly1305.
func EncryptSymmetricAESGCM ¶ added in v0.0.68
EncryptSymmetricAESGCM encrypts a message using AES-256-GCM.
func EncryptSymmetricXChaCha20Poly1305 ¶ added in v0.0.68
EncryptSymmetricXChaCha20Poly1305 encrypts a message using XChaCha20-Poly1305.
func Sha256Hash ¶ added in v0.0.60
Sha256Hash returns the SHA-256 hash of a message as a byte slice.
func SignSymmetric ¶ added in v0.0.12
SignSymmetric signs a message using a symmetric key. It is a convenience wrapper around the nacl/auth package, which uses HMAC-SHA-512-256.
func VerifyAndReadAsymmetric ¶ added in v0.0.68
VerifyAndReadAsymmetric verifies a signed message using an Ed25519 public key and returns the original message.
func VerifyAndReadAsymmetricBase64 ¶ added in v0.0.68
VerifyAndReadAsymmetricBase64 verifies a signed message using a base64 encoded Ed25519 public key and returns the original message.
func VerifyAndReadSymmetric ¶ added in v0.0.20
VerifyAndReadSymmetric verifies a signed message using a symmetric key and returns the original message. It is a convenience wrapper around the nacl/auth package, which uses HMAC-SHA-512-256.