4

during the execution of :

openssl req -new

it asked for some attributes:

-----
Country Name (2 letter code) [XX]:IT
State or Province Name (full name) []:Rome
Locality Name (eg, city) [Default City]:Rome
Organization Name (eg, company) [Default Company Ltd]:PP
Organizational Unit Name (eg, section) []:Information Technology
Common Name (eg, your name or your server's hostname) []:test
Email Address []:test at test dot it

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:claudio
An optional company name []:cc

is it possible to add an additional custom attribute during the creation?

Thank you in advance Claudio

ClaudioM
  • 1,418
  • 2
  • 16
  • 42

1 Answers1

7
1) login as root
2) open file openssl.cnf
3) add your custom attribute in "[new oids]" section
4) add description in "req_distinguished_name" section
5) save & close
6) create your new certificate

[ new oids]
 newCustom=1.2.3.4.5.6

[req_distinguished_name] 
 newCustom             = new custom attibute

openssl req -new -key server.key -out server.csr
nter pass phrase for server.key:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
new custom attribute []: 
..
..
..

I hope this could help!

Regards Claudio

ClaudioM
  • 1,418
  • 2
  • 16
  • 42
  • 3
    can you please explain the ``1.2.3.4.5.6`` What does it mean? – Bernhard Nov 21 '15 at 15:38
  • 1
    When updating my .cnf there's no prompt for the new attribute – Bernhard Nov 21 '15 at 15:44
  • I do this setting a XYZ=1.2.3.4.5.6 and then when I inspect the cert instead of having a XYZ=My Value it has a 1.2.3.4.5.6=My Value which is not what I need. – s1m3n Apr 20 '17 at 15:10
  • If I want to validate the new custom field, how can I achieve this? I add the self-signed cert. in the store, so it gets validated. But if I want to validate this particular new field, how? I use python: https://docs.python.org/3.6/library/ssl.html – user9371654 Feb 12 '19 at 11:13
  • 2
    1.2.3.4.5.6 is the id of your newCustom, actually there are default OIDs you can find them at http://www.oid-info.com @Bernhard – Vrian7 Jun 05 '19 at 20:15
  • `1.2` is reserved for ISO member bodies, so don't use that prefix. – OrangeDog Jul 18 '23 at 13:48
  • Also, this defines a custom RDN, not a custom attribute. – OrangeDog Jul 18 '23 at 14:44