1
0
Fork 0
forked from mirrors/akkoma

Merge branch 'bugfix/x509-public-key' into 'develop'

activitypub: switch to using x509 representation for public keys instead of pkcs#1

See merge request pleroma/pleroma!248
This commit is contained in:
lambda 2018-07-12 05:54:14 +00:00
commit b06e61bc4e
2 changed files with 2 additions and 2 deletions

View 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])
%{

View file

@ -13,6 +13,6 @@ test "Renders a user, including the public key" 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