Documentation
¶
Index ¶
- type TinyCrypto
- func (c *TinyCrypto) Decrypt(ciphertext, key []byte) (plaintext []byte, err error)
- func (c *TinyCrypto) DecryptAsymmetric(ciphertext, privateKey []byte) (plaintext []byte, err error)
- func (c *TinyCrypto) Encrypt(plaintext, key []byte) (ciphertext []byte, err error)
- func (c *TinyCrypto) EncryptAsymmetric(plaintext, publicKey []byte) (ciphertext []byte, err error)
- func (c *TinyCrypto) GenerateKeyPair() (publicKey []byte, privateKey []byte, err error)
- func (c *TinyCrypto) Sign(message, privateKey []byte) (signature []byte, err error)
- func (c *TinyCrypto) Verify(message, signature, publicKey []byte) (ok bool, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TinyCrypto ¶
type TinyCrypto struct{}
TinyCrypto is the engine for cryptographic operations.
func (*TinyCrypto) Decrypt ¶
func (c *TinyCrypto) Decrypt(ciphertext, key []byte) (plaintext []byte, err error)
Decrypt performs symmetric decryption of ciphertext using AES-GCM with a 32-byte key.
func (*TinyCrypto) DecryptAsymmetric ¶
func (c *TinyCrypto) DecryptAsymmetric(ciphertext, privateKey []byte) (plaintext []byte, err error)
DecryptAsymmetric decrypts ciphertext with a private key.
func (*TinyCrypto) Encrypt ¶
func (c *TinyCrypto) Encrypt(plaintext, key []byte) (ciphertext []byte, err error)
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 (*TinyCrypto) EncryptAsymmetric ¶
func (c *TinyCrypto) EncryptAsymmetric(plaintext, publicKey []byte) (ciphertext []byte, err error)
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 (*TinyCrypto) GenerateKeyPair ¶
func (c *TinyCrypto) GenerateKeyPair() (publicKey []byte, privateKey []byte, err error)
GenerateKeyPair generates a new ECDSA key pair for asymmetric cryptography using the P-256 curve.