I have an array of bytes that is der encoded, I need to decode these bytes into asn1 object using Powershell or by accessing a C# library from powershell. In python there is a module built to do this process called pyasn1.
I tried using the C# class ASNEncodedData but it doesn't provide a der decoder. I did accomplish the process successfully using the following in python.
Python Code to decode Der in hex form into asn1 object:
import from pyasn1.codec.der import decoder
asn1_object = decoder.decode(hexadecimal)
I expect to be able to decode the der encoded data into an asn1 object that looks like this:
{
"type": "0x30",
"lengthSize": 0,
"length": 89,
"children": [
{
"type": "0x30",
"lengthSize": 0,
"length": 19,
"children": [
{
"type": "0x06",
"lengthSize": 0,
"length": 7,
"value": "0x2a8648ce3d0201"
},
{
"type": "0x06",
"lengthSize": 0,
"length": 8,
"value": "0x2a8648ce3d030107"
}
]
},
{
"type": "0x03",
"lengthSize": 0,
"length": 66,
"value": "0x04213d5258bc6c69c3e2139675ea3928a409fcffef39acc8e0c82a24ae78c37ede98fd89c0e00e74c997bb0a716ca9e0dca673dbb9b3fa72962255c9debcd218ca",
"children": []
}
]
}