我正在尝试在Erlang中执行一些与公钥相关的操作,它们要求我跟踪公钥。根据这个页面,我应该能够使用
我有一个名为
根据文档,我期望这会返回一个RSAEntry,然后我可以将其解码为公钥。通过这种机制导入公钥是否需要进行特殊处理?GPG密钥实际上是有效的PEM文件吗?我是否遗漏了其他内容?
file:read_file/1
和public_key:decode_pem/1
导入PEM格式的密钥。但问题是,当我尝试导入GPG公钥时,我没有得到结果。我有一个名为
inaimathi.pubkey
的文件,其内容如下:-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.11 (GNU/Linux)
mQINBE9NBIQBEADMSzN6b0FaPP0rGiLDWKfH4ehN66Z0SAIynXm6lBHjmO69pNsm
iIe4p1X9aXhr7EgEZKdbqevfXW7NuA/oL7Rbt+tzBT5nS2cYSHoZhUC/onVhJxUb
drCR9NsBDZc1wZs+b95K3vWW91wMPYs4tn71DeeNgUVCcZOGofWltI7+etTVVIyG
zMEW4lOiEwBgLee+5u3XyGsBbyhtWnbp8ZMewiXjo14w0UCMEQxvf55NjggAO/vR
C+Czz5FQ7m9AnZwqIZJfaAw+aM81lmcXRZenGZ/H25H6WLq2DrVXnRjEyUvK+juj
K6rTHcot6K4Cgvo3P47uZcze92c4KaI22jTePRB1qov8ygAQw8BPsaZ+cA3AQ2Zv
4hjIyx2Qovs+vb1xWhk9Mgqyt0ToMZ6HNn386ICxaeYR8XY/rhf9ej0PJOS5c9Nx
reeTdrYXeco27kp/x+nDSWzqy0MrSAAD19xCK1w8Eiwc9MmjAAX1yarQzUy/ICey
eY6SaBfdK7x7A1ecUSu7mS7LmGFWB49Tx5u3ENXw9rU2hKbmGbbQsc+xCx5s7ZM1
q0aATJsUO4fsNe+4/9cBXCSP+4P6irX1EfliqaySt0LEr0WYhIgNgYq8PB7yx4Cv
0mOMv8lXBMYZs8NTrMJl2XHfi3egu8Ti14VChCklnWe95sZvKrk9/3BYxwARAQAB
tCtMZW8gWm92aWMgKEluYWltYXRoaSkgPGxlby56b3ZpY0BnbW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O7BUWxK+dH
E+8YuCe53OAvNU0BFT8MAe/vB9kMl4N3p/3bJPuzmP4lnAGrLwzBZPkiQTNq8aj8
5NsttvIOclBY5A==
=Zqph
-----END PGP PUBLIC KEY BLOCK-----
这个看起来格式正确,但是我得到的结果是
1> {ok, GpgBin} = file:read("inaimathi.pubkey").
{ok,<<"-----BEGIN PGP PUBLIC KEY BLOCK-----\nVersion: GnuPG v1.4.11 (GNU/Linux)\n\nmQINBE9NBIQBEADMSzN6b0FaPP0rGiLDWKf"...>>}
2> public_key:pem_decode(GpgBin).
[]
根据文档,我期望这会返回一个RSAEntry,然后我可以将其解码为公钥。通过这种机制导入公钥是否需要进行特殊处理?GPG密钥实际上是有效的PEM文件吗?我是否遗漏了其他内容?
gpg
直接以PEM格式输出公钥,还是这意味着我需要在Erlang中进行一些密钥处理才能接受来自GnuPG的公钥? - undefined