Length of buffer does not match length of ASN.1 sequence. #2

Closed
opened 2020-04-24 12:12:58 +00:00 by Ghost · 9 comments

We’re using this lib to get infos about LE certificates. This has worked fine so far.

Now I have a certificate, for which I get Error: Length of buffer does not match length of ASN.1 sequence.

Added some logging in asn1-parser.js:

  console.log('len', len); // 2551
  console.log('asn1.lengthSize', asn1.lengthSize); // 2
  console.log('asn1.length', asn1.length); // 1373

When I disable the check if (len !== 2 + asn1.lengthSize + asn1.length), the certificate is still properly decoded.

Any idea what’s going on here? I could share the certificate privately if that helps!

We’re using this lib to get infos about LE certificates. This has worked fine so far. Now I have a certificate, for which I get `Error: Length of buffer does not match length of ASN.1 sequence.` Added some logging in `asn1-parser.js`: ``` console.log('len', len); // 2551 console.log('asn1.lengthSize', asn1.lengthSize); // 2 console.log('asn1.length', asn1.length); // 1373 ``` When I disable the check `if (len !== 2 + asn1.lengthSize + asn1.length)`, the certificate is still properly decoded. Any idea what’s going on here? I could share the certificate privately if that helps!
Owner

Yes, please do. aj@therootcompany.com

Yes, please do. aj@therootcompany.com
Author

Done.

Done.
Owner

I never got it, not even in my spam.

Perhaps put it in a zip file and send it to coolaj86@gmail.com instead.

I never got it, not even in my spam. Perhaps put it in a zip file and send it to coolaj86@gmail.com instead.
Author

Done.

Done.
Author

Did my email arrive?

Did my email arrive?
Author

Hello coolaj86,

I use NodeRed to manage my certificates, everything was working perfectly and now it doesn't work anymore.
I have an error message, see below.
I see here that another person had this problem.
Could you help me solve this one. I am attaching the only messages I receive.
Inside this ?
Many Thanks for your help.

/Jean-Luc

Hello coolaj86, I use NodeRed to manage my certificates, everything was working perfectly and now it doesn't work anymore. I have an error message, see below. I see here that another person had this problem. Could you help me solve this one. I am attaching the only messages I receive. [Inside this ?](https://git.coolaj86.com/coolaj86/cert-info.js/src/branch/master/lib/asn1-parser.js#L114) Many Thanks for your help. /Jean-Luc
Author

Solved.

We were accidentally passing the entire chain instead of just the cert. This worked in some (most?) cases, in some not. Fixed by just passing the cert.

Solved. We were accidentally passing the entire chain instead of just the cert. This worked in some (most?) cases, in some not. Fixed by just passing the cert.
Ghost closed this issue 2020-06-02 15:17:09 +00:00
Author

Hello, I've noticed the patch but it still doesn't work.
Did you forget to update the repository? It seems to be a bit outdated.
Thanks for your help.

/JLM

Hello, I've noticed the patch but it still doesn't work. Did you forget to update the repository? It seems to be a bit outdated. Thanks for your help. /JLM
Author

@JLM May well use https://www.npmjs.com/package/certpem. It's from the same guy. :)

@JLM May well use https://www.npmjs.com/package/certpem. It's from the same guy. :)
Sign in to join this conversation.
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: coolaj86/cert-info.js#2
No description provided.