-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"The given key was not present in the dictionary." error decoding base64 encoded CMS structure #1
Comments
I will take a look. |
Got this. The problem is that your file uses indefinite length. I'm not supporting indefinite length, because it is not allowed in DER encoding. It is supported by BER, but X.509 uses DER encoding. |
Thank you, missed that. |
What exactly? |
Sorry for not being clear. I am not familiar with those structures, what I mean is there a way to easily tell if a structure such as this is using indefinite length or definite or what encoding it is? |
You can convert this Base64-encoded string to a byte array and examine 2nd byte. If it is 0x80 (128), then ASN type uses indefinite length. DER forbids indefinite length encoding on the grounds that serialized representation of the same data may change on re-encoding. Since my ASN.1 Editor is primarily intended to decode X.509 objects and they explicitly use DER encoding, indefinite length decoding is not implemented in my code. |
@Crypt32 I understand that BER is out-of-scope for this decoder, but the error message can be improved. @audunn You can still see (not edit) the inner structure with some online tool like https://lapo.it/asn1js/ |
@FranklinYu, you mean that the tool could instead say "This is a BER-encoded file, but only DER is supported"? |
Hi,
I am trying to use your tool to decode some base64 CMS structure (from an S/MIME message). I am using the Data Converter tool of the asn.1 Editor but it does not decode showing an error of "The given key was not present in the dictionary."
This online decoder https://lapo.it/asn1js and and openssl do not seem to have an issue with it.
Also I am able to decode CMS structures from other messages, any idea as to what may be causing the error?
The text was updated successfully, but these errors were encountered: