apoc v0.1.2 Apoc.RSA.PrivateKey View Source

A Struct and set of functions to represent an RSA private key based on the underlying erlang representation.

For information on key formats in PKI see PKI PEM overview or RFC5912

See also Erlang Public Key Records

Link to this section Summary

Functions

Decrypts a message with the given public key (uses PKCS1-OAEP padding)

Dumps a key into PEM format

Encrypts a message with the given public key (uses PKCS1 standard padding)

Loads a pem encoded public key certificate string

Returns a list of the key’s parameters inline with the erlang data type

Link to this section Types

Link to this type t() View Source
t() :: %Apoc.RSA.PrivateKey{
  coefficient: integer(),
  exponent1: integer(),
  exponent2: integer(),
  modulus: integer(),
  other_prime_info: any(),
  prime1: integer(),
  prime2: integer(),
  private_exponent: integer(),
  public_exponent: integer(),
  version: :"two-prime"
}

Link to this section Functions

Link to this function decrypt(skey, ciphertext) View Source
decrypt(Apoc.RSA.PrivateKey.t(), binary()) :: {:ok, binary()} | :error

Decrypts a message with the given public key (uses PKCS1-OAEP padding).

See Apoc.RSA.decrypt/2

Dumps a key into PEM format

Link to this function encrypt(skey, message) View Source
encrypt(Apoc.RSA.PrivateKey.t(), binary()) :: {:ok, binary()} | :error

Encrypts a message with the given public key (uses PKCS1 standard padding).

See Apoc.RSA.encrypt/2

Link to this function load_pem(pem_str) View Source
load_pem(String.t()) :: {:ok, Apoc.RSA.PrivateKey.t()} | {:error, String.t()}

Loads a pem encoded public key certificate string.

Returns a list of the key’s parameters inline with the erlang data type