BSV-ex v0.2.5 BSV.Crypto.RSA.PublicKey View Source

RSA Public Key module.

Link to this section Summary

Types

Erlang RSA Public Key raw binary list

Erlang RSA Public Key sequence

t()

RSA Public Key

Functions

Converts the given RSA private key struct to an Erlang private key raw list.

Converts the given RSA public key struct to an Erlang public key sequence.=

Converts the given Erlang public key raw list to a RSA public key struct.

Converts the given Erlang public key sequence to a RSA public key struct.

Link to this section Types

Link to this type

raw_key()

View Source
raw_key() :: [binary()]

Erlang RSA Public Key raw binary list

Link to this type

sequence()

View Source
sequence() :: {:RSAPublicKey, integer(), integer()}

Erlang RSA Public Key sequence

Link to this type

t()

View Source
t() :: %BSV.Crypto.RSA.PublicKey{modulus: integer(), public_exponent: integer()}

RSA Public Key

Link to this section Functions

Converts the given RSA private key struct to an Erlang private key raw list.

Link to this function

as_sequence(public_key)

View Source
as_sequence(t()) :: sequence()

Converts the given RSA public key struct to an Erlang public key sequence.=

Examples

iex> public_key = BSV.Crypto.RSA.PrivateKey.from_sequence(BSV.Test.rsa_key)
...> |> BSV.Crypto.RSA.PrivateKey.get_public_key
...>
...> BSV.Crypto.RSA.PublicKey.as_sequence(public_key)
...> |> is_tuple
true
Link to this function

from_raw(list)

View Source
from_raw(raw_key()) :: t()

Converts the given Erlang public key raw list to a RSA public key struct.

Link to this function

from_sequence(rsa_key_sequence)

View Source
from_sequence(sequence()) :: t()

Converts the given Erlang public key sequence to a RSA public key struct.

Examples

iex> public_key_sequence = BSV.Crypto.RSA.PrivateKey.from_sequence(BSV.Test.rsa_key)
...> |> BSV.Crypto.RSA.PrivateKey.get_public_key
...> |> BSV.Crypto.RSA.PublicKey.as_sequence
...>
...> public_key = BSV.Crypto.RSA.PublicKey.from_sequence(public_key_sequence)
...> public_key.__struct__ == BSV.Crypto.RSA.PublicKey
true