Documentation
¶
Index ¶
- func Decrypt(ciphertext, key []byte) (plaintext []byte, err error)
- func DecryptAsymmetric(ciphertext, privateKey []byte) (plaintext []byte, err error)
- func Encrypt(plaintext, key []byte) (ciphertext []byte, err error)
- func EncryptAsymmetric(plaintext, publicKey []byte) (ciphertext []byte, err error)
- func GenerateKeyPair() (publicKey []byte, privateKey []byte, err error)
- func HMACEqual(mac1, mac2 []byte) bool
- func HMACSHA256(key, message []byte) []byte
- func Sign(message, privateKey []byte) (signature []byte, err error)
- func Verify(message, signature, publicKey []byte) (ok bool, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decrypt ¶ added in v0.0.19
Decrypt performs symmetric decryption of ciphertext using AES-GCM with a 32-byte key.
func DecryptAsymmetric ¶ added in v0.0.19
DecryptAsymmetric decrypts ciphertext with a private key.
func Encrypt ¶ added in v0.0.19
Encrypt performs symmetric encryption of plaintext using AES-GCM with a 32-byte key. It returns the ciphertext, which includes the nonce and the encrypted data.
func EncryptAsymmetric ¶ added in v0.0.19
EncryptAsymmetric encrypts plaintext for a given public key using ECIES (ECDH + AES-GCM). The returned ciphertext includes the ephemeral public key needed for decryption.
func GenerateKeyPair ¶ added in v0.0.19
GenerateKeyPair generates a new ECDSA key pair for asymmetric cryptography using the P-256 curve.
func HMACEqual ¶ added in v0.0.20
HMACEqual reports whether two MACs are equal, in constant time. A non-constant-time comparison of a MAC is a timing oracle: never compare signatures with == or a byte loop that returns early.
func HMACSHA256 ¶ added in v0.0.20
HMACSHA256 returns the HMAC-SHA256 of message under key. Used by tinywasm/user to sign JWT session tokens.
Types ¶
This section is empty.