Documentation
¶
Index ¶
- Constants
- func ECDecryptPriv(privkey *btcec.PrivateKey, msg []byte, kdf bool) ([]byte, error)
- func ECDecryptPrivPub(privkey *btcec.PrivateKey, pubkey *btcec.PublicKey, msg []byte, kdf bool) ([]byte, error)
- func ECEncryptPub(pubkey *btcec.PublicKey, msg []byte, kdf bool) ([]byte, error)
- func ECEncryptPubPriv(pubkey *btcec.PublicKey, ephKey *btcec.PrivateKey, msg []byte, kdf bool) ([]byte, error)
- func ECPrivateKeyToPEM(key *ecdsa.PrivateKey) (string, error)
- func EcPubKeyBytesToPem(rawkey []byte) string
- func MarshalECPrivateKey(key *ecdsa.PrivateKey) ([]byte, error)
- func ParseKoblitzPrivPem(pemstring string) (*btcec.PrivateKey, error)
- func ParseKoblitzPubPem(pemstring string) (*btcec.PublicKey, error)
Constants ¶
const SEKPC256K1OID = "2b8104000a"
Variables ¶
This section is empty.
Functions ¶
func ECDecryptPriv ¶
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 ¶
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 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 :-(
Types ¶
This section is empty.