4 ms·
I've been thinking about a good way to explain this for a couple of days I think the best way is convert the ASN.1 to some psuedo-typed-JSON. For an X.509v3 pu
by rkeene2 5y ago
I've been thinking about a good way to explain this for a couple of days I think the best way is convert the ASN.1 to some psuedo-typed-JSON.
For an X.509v3 public key, the ASN.1 would look like this in JSON-with-types:
[
[
[type:<oid>]: "1.2.840.113549.1.1.1",
[type:<null>]
],
[type:<bitstring>]: <encoded>[
[type:<bigint>]: 39054839120582390568029762340674230...,
[type:<bigint>]: 65537
]
]
"<encoded>" here means an ASN.1 value is serialized and then contained as a binary string.
As you can see here, you only know the structure and type. This falls apart here at the "bitstring" value -- it's an opaque binary blob, which happens to be ASN.1 again, which you would only know if you know the schema.
If we converted this to something more self-describing it would look more like (borrowed kind of from TJSON):
{
"publicKeyInfo:<o<oid,...>>": {
"publicKeyType:<oid>": "1.2.840.113549.1.1.1",
"publicKeyParams:<null>": null
},
"publicKey:<o>": {
"n:<bigint>": "39054839120582390568029762340674230...",
"e:<bigint>": "65537"
}
}
Having this kind of human description in addition to the type and structure makes it easier to work with if you don't know what's inside the structures.
- pas 5y agoThanks! This indeed is absolutely horribly insane, yet I guess there are some good-ish reasons for why this is the way this is.