micromdm / scep

Go SCEP server
MIT License
310 stars 121 forks source link

Include challenge password into CSR #228

Closed Simkiw closed 5 months ago

Simkiw commented 5 months ago

Hi,

I noticed the stdlib go x509 package does not handle the challenge password.
I came across your code which seems to be including it, though, I can't make it work.

As I try convert my DER into a CSR/PEM, I get the following

Unable to load X509 request
407719B8E57F0000:error:068000A8:asn1 encoding routines:asn1_check_tlen:wrong tag:../crypto/asn1/tasn_dec.c:1188:
407719B8E57F0000:error:0688010A:asn1 encoding routines:asn1_template_noexp_d2i:nested asn1 error:../crypto/asn1/tasn_dec.c:613:Field=set, Type=X509_ATTRIBUTE
407719B8E57F0000:error:0688010A:asn1 encoding routines:asn1_template_noexp_d2i:nested asn1 error:../crypto/asn1/tasn_dec.c:654:Field=attributes, Type=X509_REQ_INFO
407719B8E57F0000:error:0688010A:asn1 encoding routines:asn1_template_noexp_d2i:nested asn1 error:../crypto/asn1/tasn_dec.c:685:Field=req_info, Type=X509_REQ

Looks like there id a problem with that X509_ATTRIBUTE

When I try to parse the CSR with stdlib go package (you never know), I still get my CSR...without any attribute (challenge password).
Also, I don't get any error in my unit tests.

Any thoughts? Perhaps you have come across the same error?

Simkiw commented 5 months ago

Abort abort !
I was saving into wrong file.
Someone had a long day :)