BSV-ex v0.2.5 BSV.Crypto.ECIES View Source
Functions for use with ECIES asymmetric encryption. Is compatible with
ElectrumSV and bsv.js. Internally uses libsecp256k1
NIF bindings.
Examples
iex> {public_key, private_key} = BSV.Crypto.ECDSA.generate_key_pair
...>
...> "hello world"
...> |> BSV.Crypto.ECIES.encrypt(public_key)
...> |> BSV.Crypto.ECIES.decrypt(private_key)
"hello world"
Link to this section Summary
Functions
Decrypts the encrypted data with the given private key.
Encrypts the given data with the given public key.
Link to this section Functions
Link to this function
decrypt(data, private_key, options \\ [])
View Sourcedecrypt(binary(), BSV.Crypto.ECDSA.PrivateKey.t() | binary(), keyword()) :: binary()
Decrypts the encrypted data with the given private key.
Options
The accepted options are:
:encoding
- Optionally decode the given cipher text with either the:base64
or:hex
encoding scheme.
Examples
BSV.Crypto.ECIES.decrypt(encrypted_binary, private_key)
<< decrypted binary >>
Link to this function
encrypt(data, public_key, options \\ [])
View Sourceencrypt(binary(), BSV.Crypto.ECDSA.PublicKey.t() | binary(), keyword()) :: binary()
Encrypts the given data with the given public key.
Options
The accepted options are:
:encoding
- Optionally encode the returned binary with either the:base64
or:hex
encoding scheme.
Examples
BSV.Crypto.ECIES.encrypt("hello world", public_key)
<< encrypted binary >>