logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma

keys_test.exs (657B)


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