Skip to content
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

err: Data does not match to ECParameters ASN1 schema. Wrong values for Choice type #88

Closed
li0ard opened this issue Sep 14, 2024 · 2 comments · Fixed by #89
Closed

err: Data does not match to ECParameters ASN1 schema. Wrong values for Choice type #88

li0ard opened this issue Sep 14, 2024 · 2 comments · Fixed by #89

Comments

@li0ard
Copy link

li0ard commented Sep 14, 2024

Hi, i got error Data does not match to ECParameters ASN1 schema. Wrong values for Choice type when call X509Certificate constructor, but certificate is valid.
Code:

new X509Certificate(
    await Bun.file("./sod.pem").bytes()
)

image
Certificate:
sod.zip

@microshine
Copy link
Contributor

The latest version of @peculiar/asn1-ecc fixes this problem. @peculiar/x509 parses the certificate and returns cert.publicKey.alofirthm like

{
  name: '1.2.840.10045.2.1',
  parameters: Uint8Array(250) [
     48, 129, 247,   2,   1,   1,  48,  44,   6,   7,  42, 134,
     72, 206,  61,   1,   1,   2,  33,   0, 255, 255, 255, 255,
      0,   0,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,
      0,   0,   0,   0, 255, 255, 255, 255, 255, 255, 255, 255,
    255, 255, 255, 255,  48,  91,   4,  32, 255, 255, 255, 255,
      0,   0,   0,   1,   0,   0,   0,   0,   0,   0,   0,   0,
      0,   0,   0,   0, 255, 255, 255, 255, 255, 255, 255, 255,
    255, 255, 255, 252,   4,  32,  90, 198,  53, 216, 170,  58,
    147, 231, 179, 235,
    ... 150 more items
  ]
}

Going to publish the new version of @peculiar/x509 with updated dependencies in the nearest time

@microshine microshine linked a pull request Sep 17, 2024 that will close this issue
@microshine
Copy link
Contributor

@peculiar/[email protected] ha been published

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants