Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decrypt ¶
func Decrypt(data []byte, priv *PrivateKey) ([]byte, error)
Decrypt decrypts ciphertext by receiver private key
func DecryptString ¶
func DecryptString(ciphertext string, priv *PrivateKey) (string, error)
DecryptString decrypts ciphertext in hex form to plaintext by receiver private key
Types ¶
type PrivateKey ¶
type PrivateKey struct {
Pub *PublicKey
// contains filtered or unexported fields
}
PrivateKey ...
func GenerateKey ¶
func GenerateKey(curve elliptic.Curve) (*PrivateKey, error)
GenerateKey generates a new elliptic curve key pair
func PrivateKeyFromBytes ¶
func PrivateKeyFromBytes(b []byte, curve elliptic.Curve) *PrivateKey
PrivateKeyFromBytes parses a private key from its raw bytes
func PrivateKeyFromHex ¶
func PrivateKeyFromHex(hexKey string, curve elliptic.Curve) (*PrivateKey, error)
PrivateKeyFromHex parses a private key from its hex form
func (*PrivateKey) Bytes ¶
func (priv *PrivateKey) Bytes() []byte
Bytes returns private key raw bytes
func (*PrivateKey) Hex ¶
func (priv *PrivateKey) Hex() string
Hex returns private key bytes in hex form
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
PublicKey ...
func PublicKeyFromBytes ¶
PublicKeyFromBytes parses a public key from its uncompressed raw bytes
func PublicKeyFromHex ¶
PublicKeyFromHex parses a public key from its hex form
func (*PublicKey) Bytes ¶
Bytes returns the public key to raw bytes in uncompressed format (Ox04|x|y) https://secg.org/sec1-v2.pdf#subsubsection.2.3.3