Documentation
¶
Index ¶
- func Decrypt(publicKey *ecdh.PublicKey, privateKey *ecdh.PrivateKey, ciphertext []byte) ([]byte, error)
- func EncodePrivateKeyToPEM(privateKey *ecdh.PrivateKey) []byte
- func EncodePublicKeyToPEM(publicKey *ecdh.PublicKey) []byte
- func Encrypt(publicKey *ecdh.PublicKey, privateKey *ecdh.PrivateKey, plaintext []byte) ([]byte, error)
- func ReadPrivateKeyFromFile(privateKeyPath string) (*ecdh.PrivateKey, error)
- func ReadPublicKeyFromFile(publicKeyPath string) (*ecdh.PublicKey, error)
- func WriteKeyPairToFiles(keyPair *KeyPair, privateKeyPath, publicKeyPath string) error
- type KeyPair
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decrypt ¶ added in v1.0.5
func Decrypt(publicKey *ecdh.PublicKey, privateKey *ecdh.PrivateKey, ciphertext []byte) ([]byte, error)
Decrypt decrypts data using AES-GCM with a shared secret derived from ECDH
func EncodePrivateKeyToPEM ¶
func EncodePrivateKeyToPEM(privateKey *ecdh.PrivateKey) []byte
EncodePrivateKeyToPEM converts an ECDH private key to PEM format using PKCS#8
func EncodePublicKeyToPEM ¶
EncodePublicKeyToPEM converts an ECDH public key to PEM format using PKIX
func Encrypt ¶ added in v1.0.5
func Encrypt(publicKey *ecdh.PublicKey, privateKey *ecdh.PrivateKey, plaintext []byte) ([]byte, error)
Encrypt encrypts data using AES-GCM with a shared secret derived from ECDH
func ReadPrivateKeyFromFile ¶
func ReadPrivateKeyFromFile(privateKeyPath string) (*ecdh.PrivateKey, error)
ReadPrivateKeyFromFile reads and parses an ECDH private key from a file
func ReadPublicKeyFromFile ¶
ReadPublicKeyFromFile reads and parses an ECDH public key from a file
func WriteKeyPairToFiles ¶
WriteKeyPairToFiles writes ECDH key pair to files with specified permissions
Types ¶
type KeyPair ¶ added in v1.0.5
type KeyPair struct {
PrivateKey *ecdh.PrivateKey
PublicKey *ecdh.PublicKey
}
KeyPair represents an ECDH key pair
func GenerateKeyPair ¶ added in v1.0.5
GenerateKeyPair generates a new ECDH key pair using P-256
Click to show internal directories.
Click to hide internal directories.