Skip to content

OpenSSL CSR parse command display Version Unknown #23968

Answered by davidben
raviteja-b asked this question in Q&A
Discussion options

You must be logged in to vote

CSR version set to 1 using X509_REQ_set_version(x509Req.get(), nVersion);

This code snippet is not sufficient to see what you did because you did not provide the value of nVersion. That said, I can guess as to what went wrong. Your code is incorrect. In fact, a compliant CSR parser would refuse to parse your structure altogether, not just print "Unknown".

1 is not the correct version number for a CSR. CSR versions are defined as:

version       INTEGER { v1(0) } (v1,...),

https://www.rfc-editor.org/rfc/rfc2986.html#section-4

This means a version v1 CSR actually has value zero. You should be using the constant X509_REQ_VERSION_1, not 1. Better yet, just don't call X509_REQ_set_version at…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by t8m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #23963 on March 25, 2024 13:41.