Kryptonite v0.1.9 Kryptonite.RSA.PublicKey View Source
This module provides abstraction functions based around the manipulation of public keys.
Link to this section Summary
Functions
Decrypts a cypher that was generated using the matching private key. Note that
this is not a common way of doing things and you will not be likelly to use this
function. Instead, see PrivateKey.decrypt/2
function
Encrypts a given message
using the provided public key
. The resulting cypher
can later be decrypted using the Kryptonite.RSA.PrivateKey.decrypt/2
function
using the matching private key
Performs the conversion of an underlying Erlang’s public key into the library’s easy to use struct
Because this module uses Erlang lower level functions, it has to also use the native public key format that those functions expect - this helper method is therefore provided
Verifies that a given signature
matches a provided messages
and ensures that it
was issued using the private key that matches the given public key
Link to this section Types
t() :: %Kryptonite.RSA.PublicKey{ public_exponent: pos_integer(), public_modulus: pos_integer() }
Link to this section Functions
decrypt(t(), Kryptonite.RSA.cypher()) :: {:ok, Kryptonite.RSA.message()} | {:error, any()}
Decrypts a cypher that was generated using the matching private key. Note that
this is not a common way of doing things and you will not be likelly to use this
function. Instead, see PrivateKey.decrypt/2
function.
encrypt(t(), Kryptonite.RSA.message()) :: {:ok, Kryptonite.RSA.cypher()} | {:error, any()}
Encrypts a given message
using the provided public key
. The resulting cypher
can later be decrypted using the Kryptonite.RSA.PrivateKey.decrypt/2
function
using the matching private key.
Performs the conversion of an underlying Erlang’s public key into the library’s easy to use struct.
Because this module uses Erlang lower level functions, it has to also use the native public key format that those functions expect - this helper method is therefore provided.
verify(t(), Kryptonite.RSA.message(), Kryptonite.RSA.signature()) :: boolean() | {:error, :verification_error}
Verifies that a given signature
matches a provided messages
and ensures that it
was issued using the private key that matches the given public key
.