Documentation
¶
Index ¶
- Constants
- func DecryptAsymmetric(ciphertext, privateKey []byte) (plaintext []byte, err error)
- func EncryptAsymmetric(plaintext, publicKey []byte) (ciphertext []byte, err error)
- func GenerateKeyPair() (publicKey []byte, privateKey []byte, err error)
- func Sign(message, privateKey []byte) (signature []byte, err error)
- func Verify(message, signature, publicKey []byte) (ok bool, err error)
Constants ¶
View Source
const ( ErrParsePublicKey = "failed to parse public key:" ErrNotECDSAPublicKey = "not an ECDSA public key" ErrConvertECDHPublicKey = "failed to convert to ECDH public key:" ErrParsePrivateKey = "failed to parse private key:" ErrConvertECDHPrivate = "failed to convert to ECDH private key:" ErrParseEphemeralPubKey = "failed to parse ephemeral public key:" )
Variables ¶
This section is empty.
Functions ¶
func DecryptAsymmetric ¶
DecryptAsymmetric decrypts ciphertext with a private key.
func EncryptAsymmetric ¶
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 ¶
GenerateKeyPair generates a new ECDSA key pair for asymmetric cryptography using the P-256 curve.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.