I have the following public key, which should be the same,just encoded in a different way.
-----BEGIN PUBLIC KEY-----
MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAE+jkeOL+r/kTmmTUAPs9zk+PX0MydMmz3
WYUtE1qVO7KPIm4XfwbxTkRKZvkA4uOeumn+CVeBT8fV1jaWw2obbg==
-----END PUBLIC KEY-----
-----BEGIN PUBLIC KEY-----
MIIBMzCB7AYHKoZIzj0CATCB4AIBATAsBgcqhkjOPQEBAiEA////////////////
/////////////////////v///C8wRAQgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAEIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHBEEEeb5m
fvncu6xVoGKVzocLBwKb/NstzijZWfKBWxb4F5hIOtp3JqPEZV2k+/wOEQio/Re0
SKaFVBmcR9CP+xDUuAIhAP////////////////////66rtzmr0igO7/SXozQNkFB
AgEBA0IABPo5Hji/q/5E5pk1AD7Pc5Pj19DMnTJs91mFLRNalTuyjyJuF38G8U5E
Smb5AOLjnrpp/glXgU/H1dY2lsNqG24=
-----END PUBLIC KEY-----
Could anyone tell me what is the name of each format, and if there's any way to convert between the two in .net
Both are X9.62 formats of an elliptic curve public key. You can easily see this by putting the base 64 (everything between the header and footer line) into an ASN.1 decoder.
You could of course use openssl asn1parse -inform PEM
for this or you could paste the base 64 into an online decoder. For instance, here are links for public key representation 1 and representation 2.
Obviously the first one uses a named curve representation of curve seck256r1, the other one (specifiedCurve
) explicitly specifies all the parameters. There is no functional difference between the two otherwise.
I haven't seen any way to convert between the two without coding it yourself. Usually the original domain representation will be used.