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

RSA Private Key module.

Link to this section Summary

Types

Erlang RSA Private Key raw binary list

Erlang RSA Private Key sequence

t()

RSA Private Key

Functions

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

Converts the given RSA private key struct to an Erlang private key sequence.

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

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

Returns the public key from the given RSA private key.

Link to this section Types

Link to this type

raw_key()

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

Erlang RSA Private Key raw binary list

Link to this type

sequence()

View Source
sequence() ::
  {:RSAPrivateKey, atom(), integer(), integer(), integer(), integer(),
   integer(), integer(), integer(), integer(), atom() | tuple()}

Erlang RSA Private Key sequence

Link to this type

t()

View Source
t() :: %BSV.Crypto.RSA.PrivateKey{
  coefficient: integer(),
  exponent_1: integer(),
  exponent_2: integer(),
  modulus: integer(),
  other_prime_info: atom() | tuple(),
  prime_1: integer(),
  prime_2: integer(),
  private_exponent: integer(),
  public_exponent: integer(),
  version: atom()
}

RSA Private Key

Link to this section Functions

Link to this function

as_raw(private_key)

View Source
as_raw(t()) :: raw_key()

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

Link to this function

as_sequence(private_key)

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

Converts the given RSA private key struct to an Erlang private key sequence.

Examples

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

from_raw(list)

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

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

Link to this function

from_sequence(rsa_key_sequence)

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

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

Examples

iex> private_key = BSV.Crypto.RSA.PrivateKey.from_sequence(BSV.Test.rsa_key)
...> private_key.__struct__ == BSV.Crypto.RSA.PrivateKey
true
Link to this function

get_public_key(private_key)

View Source
get_public_key(t()) :: BSV.Crypto.RSA.PublicKey.t()

Returns the public key from the given RSA private key.

Examples

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