Question

The documentation at this page states that

Any value may be set using the corresponding set<Value> method.

However, I am not sure how to interpret this statement. I have tried the following but none of them compile, and nor did I expect them to.

certificate.set3();
certificate.setThree();
serverCertificate.set<3>();

What is the correct method call to set the version number explicitly?

Was it helpful?

Solution

You can not. It explicitely says:

This class represents a X.509 version 3 certificate, as specified by ISO/IEC and ANSI X9.

Update: Seems that you can not actually set the version. It "configures" itself the proper version depending on which extensions you use. In V1 there were no extensions and in V2 just few.

The version number per default is set to 1 indicating a Version 1 certificate. When including subjectUniqueID or issuerUniqueID, the version automatically will be set to 2, and when adding an extension increased to 3.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top