asym

package
v0.0.25 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

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

func DecryptAsymmetric(ciphertext, privateKey []byte) (plaintext []byte, err error)

DecryptAsymmetric decrypts ciphertext with a private key.

func EncryptAsymmetric

func 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 GenerateKeyPair

func GenerateKeyPair() (publicKey []byte, privateKey []byte, err error)

GenerateKeyPair generates a new ECDSA key pair for asymmetric cryptography using the P-256 curve.

func Sign

func Sign(message, privateKey []byte) (signature []byte, err error)

Sign creates a digital signature for a message using a private key (ECDSA with P-256 and SHA-256).

func Verify

func Verify(message, signature, publicKey []byte) (ok bool, err error)

Verify checks a digital signature of a message using a public key.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL