From: William Pitcock Date: Thu, 12 Jul 2018 02:45:48 +0000 (+0000) Subject: activitypub: switch to using x509 representation for public keys instead of pkcs#1 X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=85465512578d8113366e71d9122d336b8fd49fa4;p=akkoma activitypub: switch to using x509 representation for public keys instead of pkcs#1 --- diff --git a/lib/pleroma/web/activity_pub/views/user_view.ex b/lib/pleroma/web/activity_pub/views/user_view.ex index f4b2e0610..41bfe5048 100644 --- a/lib/pleroma/web/activity_pub/views/user_view.ex +++ b/lib/pleroma/web/activity_pub/views/user_view.ex @@ -12,7 +12,7 @@ defmodule Pleroma.Web.ActivityPub.UserView do def render("user.json", %{user: user}) do {:ok, user} = WebFinger.ensure_keys_present(user) {:ok, _, public_key} = Salmon.keys_from_pem(user.info["keys"]) - public_key = :public_key.pem_entry_encode(:RSAPublicKey, public_key) + public_key = :public_key.pem_entry_encode(:SubjectPublicKeyInfo, public_key) public_key = :public_key.pem_encode([public_key]) %{ diff --git a/test/web/activity_pub/views/user_view_test.exs b/test/web/activity_pub/views/user_view_test.exs index 0c64e62c3..7fc870e96 100644 --- a/test/web/activity_pub/views/user_view_test.exs +++ b/test/web/activity_pub/views/user_view_test.exs @@ -13,6 +13,6 @@ defmodule Pleroma.Web.ActivityPub.UserViewTest do assert result["id"] == user.ap_id assert result["preferredUsername"] == user.nickname - assert String.contains?(result["publicKey"]["publicKeyPem"], "BEGIN RSA PUBLIC KEY") + assert String.contains?(result["publicKey"]["publicKeyPem"], "BEGIN PUBLIC KEY") end end