activitypub: switch to using x509 representation for public keys instead of pkcs#1
authorWilliam Pitcock <nenolod@dereferenced.org>
Thu, 12 Jul 2018 02:45:48 +0000 (02:45 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Thu, 12 Jul 2018 03:30:22 +0000 (03:30 +0000)
lib/pleroma/web/activity_pub/views/user_view.ex
test/web/activity_pub/views/user_view_test.exs

index f4b2e0610ccd608d53b8d533192a7b63b6cc23a4..41bfe5048a886e9e3266620f73abe4e5c1a1af5d 100644 (file)
@@ -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])
 
     %{
index 0c64e62c3416807d018df6d39f932d4f66aab522..7fc870e962753840ef6dca0fa70bd627491c00c6 100644 (file)
@@ -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