ecies

package
v0.0.0-...-5b74a8b Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const SEKPC256K1OID = "2b8104000a"

Variables

This section is empty.

Functions

func ECDecryptPriv

func ECDecryptPriv(privkey *btcec.PrivateKey, msg []byte, kdf bool) ([]byte, error)

Recovers the ephemeral key and calls ECDecryptPrivPub()

func ECDecryptPrivPub

func ECDecryptPrivPub(privkey *btcec.PrivateKey, pubkey *btcec.PublicKey, msg []byte, kdf bool) ([]byte, error)

Decrypt decrypts a passed message with a receiver private key and ephemeral public key returns plaintext or decryption error

func ECEncryptPub

func ECEncryptPub(pubkey *btcec.PublicKey, msg []byte, kdf bool) ([]byte, error)

Encrypt a message using an EC public key as a start Internally an ephemeral key is generated. If kdf flag is true, then hkdf will be used to derive the key from the shared secret

func ECEncryptPubPriv

func ECEncryptPubPriv(pubkey *btcec.PublicKey, ephKey *btcec.PrivateKey, msg []byte, kdf bool) ([]byte, error)

Encrypt encrypts a passed message with a receiver public key and an (ephemeral) private key returns ciphertext or encryption error The byte slice returned conatins the ethpemeral public key [0-64], the iv [65-76], and the cipthertext with auth tag at the end

func ECPrivateKeyToPEM

func ECPrivateKeyToPEM(key *ecdsa.PrivateKey) (string, error)

EncodePrivateKey encodes an ECDSA private key to PEM format.

func EcPubKeyBytesToPem

func EcPubKeyBytesToPem(rawkey []byte) string

func MarshalECPrivateKey

func MarshalECPrivateKey(key *ecdsa.PrivateKey) ([]byte, error)

Now I need to hijack this code from x509 because they do not know the Koblitz OID :-(

func ParseKoblitzPrivPem

func ParseKoblitzPrivPem(pemstring string) (*btcec.PrivateKey, error)

TODO Rhis is a hack because I cannot do any better parsing asn1 :-(

func ParseKoblitzPubPem

func ParseKoblitzPubPem(pemstring string) (*btcec.PublicKey, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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