我遇到了将PGP公钥转换为RSA公钥格式的问题。遵循PGP格式的公钥,需要转换为XML格式。
如果有人遇到过这种情况,请帮助我。
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.1 (MingW32)
mQELBE2kxxwBCADjWSW/F/h9VkV9JizFwKXPzg1YlXyEmN/dGKTVBidOI3ZcrhQd
v3qhcWtNmBXz1BpO+YLy41AfJzysKNHrs23sMh8nKWlMSmKZZqVpimXCcCrKQ8Hi
uNNxcRN/hBdy5R4MN/N62hbFTgoZpGmrQjOXDSPozDeckQE7DjkGYvQAT63dT3jC
F99im/KC2GfHDxVh70+881ot+vUxKC6GRZAz6wth90M/5FzbKQt0GmFrq/XapqxK
ZQI5LLMzahdGzJTGEbfs8SlH6OAqZsgjgEKYaW3EooQVbrvGrdqna6PBkLbroCOl
EH/h6W9h42dFLb2OSV9OES7oidQATqzNC+oXAAYptE9CdWNrIENvbnN1bHRhbnRz
IC0gTXkgTWVkaWNhcmUgQWR2b2NhdGUgKE1NQSkgPHByb2RzdXBwb3J0QGJ1Y2tj
b25zdWx0YW50cy5jb20+iQE0BBMBAgAeBQJNpMccAhsDBgsJCAcDAgMVAgMDFgIB
Ah4BAheAAAoJEJrpFtACLTdGtKEH/3G4pB4UeiEsMwDYDO1YF4jkz2lqbItmCGek
WuVg7G1LGHgZm2cJVH0xSuTKY4WpaX1RX5iWhVgz0dSrDNkjOi3hlZJ49VzXZi8T
abQ+Uiqfu7QIWvSOmjhxdrl8FuC2ZpZLRWB93VFNGKM1qYrjphTW1uMCnU4WtkD0
e8d9M3VCC/uL72a0+0R2El80W55yZxvHD6JHlp82Gdn+sqsAEnUcg5c+USLcehgc
v931SE4VfcxW4PELcOp0gKb00Q4bWp09Is/NVR+kVUax5EaT2Wo5oe7cx8OgrzMs
5daypwibGoFCloFE4LH59hbahoM5s8Ya59YAYEBWA1u68DCBYqS5AQsETaTH1gEI
AMCvsxsZcm5kIdbXATuPJQ1PKDejeeF0t4f27vDqR9SOZKas2ExpWbmjSeF9EdJ5
e1QKm88/WSXeUuE4Sn2xBfZXfRvhWndQIs6pOi8licuht1WiuYWBlvPefMO1e15G
fHrghhQ4RcTLIG8SWDcVFbsnr92RDy8NV7qZd/N08dZ+IS7z2JV8hp8Ts0a9T01q
p1h6lCbr9CAABQmlihMQ+hM4LO9DjqDeR85I1NWNpODeoks8zx86S9xOlEBxmWg2
G90ahBxm3IsYW9KtDd+oro6s6GQroo+5C0bcHyVL6Dylmhkn4CYQ99WAzMtw3gQ8
IDFrLO7Vw1kMc+vR4LGMPpkABimJAR8EGAECAAkFAk2kx9YCGwwACgkQmukW0AIt
N0ZBxggAqLFdkvVHgsK8wx6WyZalRpimirVQxStPT8WWlGyg8zJIGxbAzC6f4Fml
IuXGQYse+D8LfL7leWCyGu71+IZb22XCQ7ZO2ogWl6txUO5jWgPkoPBi0XMK/tLu
pT1WP8/lzrh1XQgwvLME+dcTMeuqgV5uDUmhn2OX9j8N3iyZeOV84cFrYmgrNfHn
lHlGx2kyXhgUwfK6noIUljprImIjlntGL0sh6lxTiu5bWMpXJVeJdRjNXuf4G+2/
mLU7BfsNP5jDr3+isTTLcOlZR0PHiAywIFPA2VOMTscB6nNEHiu8FLNFnY+QgboT
uC4E2095FYSXRMXc/rif7+d5+NApAg==
=+Q6Q
-----END PGP PUBLIC KEY BLOCK-----
这需要转换为RSAKeyValue XML格式,如下所示。
<RSAKeyValue>
<Modulus>151Vw6Kq51bpblahblahblahWCkPmD345ncclzFrmeb9fjpE+B6VsIAqP3kahu00p33BmFpDpXOcgi uRC2En0HoGqyZB9ifvNlPhT7flZ1uVuC9JtywG3FmYRsqbpJuT7VTIAHYExU6T/FyRuyIbhdUVwhue7ARaObsEWszE1IoM7+XcYYs=</Modulus>
<Exponent>AQAB</Exponent>
<P>+7OU6YErvfk84O/2bX5s2753xE+pdiyJl3j8gy4zMh4UKeKVhyxgSJJCvNTl9XVIya6xnCWPkHVy8ylNqyLiHQ==</P>
<Q>20v7/nODe/jKcbsiYEwzGXp0ZyiG17JqzOBKrDFu6bwPiAEHzZln0CYfUn0E hJdCmetaq9WFXk27mbK3Z6aBxw==</Q>
<DP>RpoN6B26dlRGFlZZCkePI2he0esCfsppYdqnAejgpWs4 frM2/C6fZ1vXan5RbrOSUjg1S7ZhecToFHr+dUWYpQ== </DP>
<DQ>ayaHbF7YwfxgPo3nUBIrbamNstH0gPQmhxCYq+ZDgWV oWVXXkDgCp4vZBh8b1AVsf3SmCwv7bIaiwYi3YKfVBQ==</DQ
<InverseQ>YjvieMYPEDdUHqSZRWAsFlEESd3NczFCrbBaS HzbsbOZeDrccvUfoOP2jeIhuMt0qQwMqXY/NJau9Ldwdx7xNw==</InverseQ>
<D>wEg6bM5LVSWoQgWpoldz5dQWfQjqQVc8WzKpDA HQ8ejsm0ug4ZwRcRRnKZs3o7OTsiAJCfjqT9ij1gKMoeLrXIM1 RDOcAYBxI0qwWdRrr3sbar7ntMYmy4tlTTf8/G+ypw+CJi1gz2umswcx4MHhNTUGTUHSmjEjDTFfh3sW64k= </D>
</RSAKeyValue>
答案 0 :(得分:5)
虽然通常 可以从OpenPGP RSA密钥中提取密钥材料(注意OpenPGP也使用DSS / Elgamal密钥),但是您的示例有些不一致,因为它声明 public OpenPGP密钥和私有 RSA / XML密钥。因此,我认为在继续之前对这些事情进行排序是有意义的(因为无法从公共RSA密钥获取私有RSA密钥)。
答案 1 :(得分:0)
最后从这篇SO帖子中得到了我想要的东西。