1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.KeysTest do
10 test "generates an RSA private key pem" do
11 {:ok, key} = Keys.generate_rsa_pem()
14 assert Regex.match?(~r/RSA/, key)
17 test "returns a public and private key from a pem" do
18 pem = File.read!("test/fixtures/private_key.pem")
19 {:ok, private, public} = Keys.keys_from_pem(pem)
21 assert elem(private, 0) == :RSAPrivateKey
22 assert elem(public, 0) == :RSAPublicKey