CryptoSys PKI Pro Manual

X.509 Extensions Parameter

The szExtensions parameter is optional and is used to set advanced options in new X.509 certificates and certificate signing requests made using the X509_MakeCert, X509_MakeCertSelf and X509_CertRequest functions. The szExtensions parameter is expected to contain a list of one or more attribute-value pairs of the form type=value separated by a semicolon (';' U+003B) with the type names as defined below. Valid attribute-value pairs are:

Fields for subject alternative name extension (duplicates OK):

Extensions for making X.509 certificates only (duplicates ignored):

Extensions for making X.509 certificates and certificate requests:

The type names are not case sensitive. So, for example, dnsname and DnSnaMe and dNSName are all equivalent.

rfc822Name
To set the rfc822 email address in the subjectAltName extension, e.g. rfc822Name=myname@testorg.com.
dNSName
To set the DNS name in the subjectAltName extension, e.g. dNSName=foo.example.net.
URI
To set the Uniform Resource Identifier in the subjectAltName extension, e.g. uri=http://www.ietf.org/rfc/rfc3986.txt.
iPAddress
To set the IP address in the subjectAltName extension, e.g. iPAddress=192.168.15.1 or iPAddress=2001:db8:85a3:0:0:8a2e:370:7334. IPv4 addresses must be in dotted-quad format d.d.d.d using exactly four decimal integers of value between 0 and 255. IPv6 addresses must be in the form x:x:x:x:x:x:x:x, exactly 8 groups of one to four hexadecimal digits separated by colons. The compressed zero form using "::" is not accepted. Alternatively, IPv6 addresses may be specified in the base-85 notation of [RFC1924]!
serialNumber
To override the serial number set by nCertNum with a larger, unlimited-length integer represented in hexadecimal format, e.g. serialNumber=12deadbeefcafe0123 (the decimal number 348087084311274979619). If the first hex digit is greater than 7, it will preceded by a '00' to make sure the integer is stored as a positive value.

[New in v11.0] Add the prefix "#d" to specify the serial number as a large decimal integer, e.g. serialNumber=#d348087084311274979619, or add the prefix "#x" to specify unambiguously the serial number as a hexadecimal-encoded integer, e.g. serialNumber=#x12deadbeefcafe0123. If no "#" prefix is found, the default is to assume hexadecimal encoding.

notAfter
To override the validity period set by nYearsValid with a specific date and time in ISO format, e.g. notAfter=2030-12-31 or notAfter=2030-12-31T14:03:59. If no time is given it will default to 23:59:59. Note that this time is UTC (GMT) not local.
notBefore
To override the default start time from one minute ago to a specific date and time in ISO format ISO format, e.g. notBefore=2008-12-31. If no time is given it will default to 00:00:01. Note that this time is UTC (GMT) not local.
subjectKeyIdentifier
To set the subjectKeyIdentifier extension with an octet string (binary) value specified in hex format e.g. subjectKeyIdentifier=fedcba9876543210.
certificatePolicies
To set the certificatePolicies extension with a single policy information term with an object identifier (OID) in dotted form, e.g. certificatePolicies=2.16.840.1.101.3.2.1.48.1. Only one policy information term can be specified and no qualifiers are permitted.
cRLDistributionPoints
[New in v20.7] To set the cRLDistributionPoints extension with a single DistributionPoint, e.g. cRLDistributionPoints=http://dodgycert.example.com/evca.crl. Only one distributionPoint can be specified and it must be a general name of type URI.
smimeCapabilities
[New in v20.5] To set the smimeCapabilities extension with one or more SMIMECapability provide a list of one or more hexadecimal strings, separated by commas ",". Each hexstring must be a hexadecimal representation of the DER-encoded ASN.1 value of the SMIMECapability (which will always begin with "30"). The S/MIME Capabilities Extension is defined in [RFC4262]. For examples of DER encodings see section 6 of [RFC5753] and section 8 of [RFC8418].

For example, sMIMECapabilities=300B0609608648016503040102,301A060B2A864886F70D0109100313300B0609608648016503040105; will set two smimeCapability nodes, one for aes128-CBC and the other for "ECDH with HKDF using SHA-256" (ecdhHKDF-SHA256) with aes128-wrap as the key wrapping algorithm.

SEQUENCE {
  OBJECT IDENTIFIER sMIMECapabilities (1 2 840 113549 1 9 15)
  OCTET STRING, encapsulates {
    SEQUENCE {
      SEQUENCE {
        OBJECT IDENTIFIER aes128-CBC (2 16 840 1 101 3 4 1 2)
      }
      SEQUENCE {
        OBJECT IDENTIFIER ecdhHKDF-SHA256 (1 2 840 113549 1 9 16 3 19)
        SEQUENCE {
          OBJECT IDENTIFIER aes128-wrap (2 16 840 1 101 3 4 1 5)
          }
        }
      }
    }
  }
30 38  --SEQUENCE/56=0x38
   06 09  --OBJECTIDENTIFIER/9=0x9
      2a 86 48 86 f7 0d 01 09 0f
      --sMIMECapabilities (1.2.840.113549.1.9.15)
   04 2b  --OCTETSTRING/43=0x2B
      --encapsulates:
      30 29  --SEQUENCE/41=0x29
         30 0b  --SEQUENCE/11=0xB
            06 09  --OBJECTIDENTIFIER/9=0x9
               60 86 48 01 65 03 04 01 02
               --aes128-CBC (2.16.840.1.101.3.4.1.2)
         30 1a  --SEQUENCE/26=0x1A
            06 0b  --OBJECTIDENTIFIER/11=0xB
               2a 86 48 86 f7 0d 01 09 10 03 13
               --ecdhHKDF-SHA256 (1.2.840.113549.1.9.16.3.19)
            30 0b  --SEQUENCE/11=0xB
               06 09  --OBJECTIDENTIFIER/9=0x9
                  60 86 48 01 65 03 04 01 05
                  --aes128-wrap (2.16.840.1.101.3.4.1.5)
keyUsage
[New in v11.0] To set the keyUsage extension bits, specify a comma-separated list of any of the following keywords from [PKIX] s4.2.1.3.
digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment, keyAgreement, keyCertSign, cRLSign, encipherOnly, decipherOnly.
For example, "keyUsage=digitalSignature,nonRepudiation;". Careful, for X.509 certificates, these will add to any values in nKeyUsageFlags.

By default, the keyUsage extension is marked critical (as per [PKIX]: "When present, conforming CAs SHOULD mark this extension as critical").
[New in v20.0] To mark this extension as non-critical, include the key word noncritical in the attribute value, e.g. "keyUsage=keyAgreement,noncritical;".

extKeyUsage
[New in v12.3] To set extKeyUsage extension purposes, specify a comma-separated list of any of the following keywords from [PKIX] s4.2.1.12. (Note that the special KeyPurposeId anyExtendedKeyUsage is not supported.)
serverAuth, clientAuth, codeSigning, emailProtection, timeStamping, OCSPSigning.
To make the extension critical, append ",critical".

For example, "extKeyUsage=serverAuth,clientAuth,emailProtection,critical;".

Some examples of valid input strings to the szExtensions parameter:

"rfc822name=AliceRSA@example.com"
"serialNumber=46346BC7800056;subjectKeyIdentifier=77D2B4D1B74C8A8AA3CE"
"rfc822Name=me@here.com;notAfter=2020-12-31T12:00:59"
"rfc822Name=AliceRSA@example.com;notBefore=1999-09-19T01:08:47;notAfter=2039-12-31"
"dnsname=foo.example.net;uri=ftp://ftp.is.co.za/rfc/rfc1808.txt;ipaddress=127.0.0.1"
"AliceRSA@example.com"   // (legacy behaviour=>rfc822Name)

Space characters are significant between the '=' and the ';', so the following examples will produce different results.

dnsname=foo.example.com;
dnsname= foo.example.com;
dnsname=foo.example.com ;

If an attribute is not specified, the relevant field will either be omitted or will default to the values set by nCertNum, nYearsValid and the current system time. It is an error to specify an invalid attribute name. The attributes meant only for making X.509 certificates are not accepted for certificate signing requests, and any duplicates of the X.509-only attributes will be ignored. The values of ASCII strings will be copied exactly as given without any further checks, regardless of whether or not they are suitable. For example, we don't check that the value passed for an rfc822Name is actually a valid email address. It's up to the user to police the input to this rather sharp tool. See our AOC Policy below.

[PREV: LDAP String Representation of Distinguished Names...]   [Contents]   [Index]   
   [NEXT: Add an arbitrary X.509 Extension...]

Copyright © 2004-24 D.I. Management Services Pty Ltd. All rights reserved. Generated 2024-09-23T07:52:09Z.