Signing Certificates

On the present page you are acting as Certificate Authority to fulfill the CSR which you created as the Requesting Party on the previous page.

A third-party Certificate Authority would inspect the CSR and find out which extensions are asked to be included in the requested certificate. Extensions which the CA accepts will then be included in the certificate.

The minimalistic CSR from the previous page did not request any extensions, because - when acting as your own CA - you can simply grant all the extensions you know you need.

Extensions which the CA is willing to grant in the certificate are either specified in a dedicated section of the CA configuration file or a separate extensions file. In this example where a certificate for the OPC UA communication is created, the ua_app_inst_client_cert section of the extension file called 'ua_app_ext.cnf' is used.

Certificate Generation

To create and sign the certificate requested on the previous page, execute the command below.

PS> openssl ca `
        -config certificate-authority/ca.cnf `
        -extfile certificate-authority/ua_app_ext.cnf `
        -extensions ua_app_inst_client_cert `
        -days 375 `
        -notext `
        -md sha256 `
        -in certificate-authority/csr/TheCertificateRequest.pem `
        -out certificate-authority/signedcerts/TheGrantedCertificate.pem
Details

In this command …​

  • -config - specifies the OpenSSL configuration file

  • -extfile -

  • -extensions - specifies the extensions section of the -extfile or the -config file

  • -days - defines the amount of days until the certificate expires.

  • -notext - prevents the text form of a certificate from being included in the output file

  • -md - specifies the digest type of the certificate’s signature; here a 256 bit SHA-2 encrypted hash is used; sha256 is the default value, so there is actually no need to set it specifically;
    To see a list of all available options execute

    PS> openssl dgst -list
  • -in - the path/filename of the Certificate Signing Request from the Requesting Party; here 'certificate-authority/csr/TheCertificateRequest.pem'

  • -out - the path/filename of the generated certificate; here 'requesting-party/certs/TheGrantedCertificate.pem'

For further options of the 'ca' command see the OpenSSL documentation.

In the command line above the new certificate is directly written to the requesting-party/certs folder instead of 'transfering' it from the Certificate Authority to the Requesting Party.

A dialog will be displayed, showing a number of presets while also asking for additional user input.
These presets are taken from the section specified for the -extensions parameter of the file specified for the -extfile parameter. In this example we are using the the [ua_app_inst_client_cert] extension section of the ua_app_ext.cnf file. This specifies the extensions for X.509 certificates thart are required OPC UA for connections.

Click here to review the [ua_app_inst_client_cert] extension section

The [ua_app_inst_client_cert] Extension Section

[ ua_app_inst_client_cert ]
# Extensions for UA client certificates; see https://www.openssl.org/docs/manmaster/man5/x509v3_config.html
basicConstraints = CA:FALSE
nsCertType = client
nsComment = "OpenSSL Generated Client Certificate"
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid,issuer
keyUsage = critical, nonRepudiation, digitalSignature, keyEncipherment, dataEncipherment
extendedKeyUsage = clientAuth
subjectAltName = @alt_names_client (1)

[alt_names_client]
URI=urn:<domainname>:RequestingPartyCompany:<application Name> (2) (3)
DNS.1=<hostname> (4)
DNS.2=<fully qualified domain name> (5)
DNS.3=localhost
1 for the client, use the options defined in the [alt_names_client] group below instead of a single subjectAltName
2 Replace 'RequestingPartyCompany' with your company name
3 specify the application URI for clients
Click here to show/hide more information

The application URI is a globally unique identifier for the instance of the application. For clients like AspenTech Inmation DataSources it’s following this scheme:

urn:<Domain Names>:<Organization Name>:<Application Name>

The value of the 'URI' option in the certificate’s subjectAltName extension of the OpenSSL configuration file and the application URI configured on the client (e.g. another Node) need to match.

For OPC UA DataSources the Domain Names, Organization Name, and Application Name are fetched from the same-named properties in the Own Certificate Details property compound of the Node object to which the Datasource object belongs.

Property Description

Application Name

This is a read-only property which defaults to 'AspenTech Inmation OT DataFabric'.

Organization Name

This should be the name of the organization running the datasource. Can be empty.

Domain Names

A list of domain names.
If empty, a reverse domain name look-up is attempted using the 127.0.0.1 IP address.
If the look-up fails, the computer host name is used.
If the list is not empty, all entries are used in the application URI.

It is recommended to use only a single domain name entry in the Domain Names property to avoid varying results for the reverse domain name look-up.

With the property values shown in the screenshot, the OPC UA application URI used by the UA Datasource object is

urn:MYHOST:MYCOMPANY:AspenTech Inmation OT DataFabric`
4 replace with the actual name of the machine on which application/service is running
5 replace with actual fully qualified domain name

In the dialog, enter your specific information instead of the '<examples>':

Using configuration from ca.cnf
Enter pass phrase for c:/root_ca-2/private/TheCertificateAuthority.key.pem: <CA key pass phrase> (1)
Check that the request matches the signature
Signature ok
Certificate Details:
        Serial Number: 4099 (0x1003)
        Validity
            Not Before: Feb 13 08:34:12 2024 GMT                    # today
            Not After : Feb 22 08:34:12 2025 GMT                    # today + 375 days (as specified in the -days option)
        Subject:
            countryName               = DE                          # as specified in the CSR
            stateOrProvinceName       = NRW                         # as specified in the CSR
            localityName              = Cologne                     # as specified in the CSR
            organizationName          = TheRequestingCompany        # as specified in the CSR
            organizationalUnitName    = Requester                   # as specified in the CSR
            commonName                = TheCompany.com              # as specified in the CSR
            emailAddress              = requester@thecompany.com    # as specified in the CSR
        X509v3 extensions:
            X509v3 Basic Constraints:
                CA:FALSE
            Netscape Cert Type:
                SSL Client
            Netscape Comment:
                OpenSSL Generated Client Certificate
            X509v3 Subject Key Identifier:
                4B:47:2B:BE:9C:2B:95:22:73:10:6C:63:28:D3:C5:AE:F8:E3:FF:E7
            X509v3 Authority Key Identifier:
                keyid:40:CB:5E:C0:5E:30:BC:C9:56:6F:64:3D:11:34:86:B0:D7:7E:E1:C6

            X509v3 Key Usage: critical
                Digital Signature, Non Repudiation, Key Encipherment, Data Encipherment
            X509v3 Extended Key Usage:
                TLS Web Client Authentication
            X509v3 Subject Alternative Name:                    # as defined in the specified extension (ua_app_inst_client_cert)
                URI:urn::RequestingPartyCompany:system-inmation, DNS:<hostname>, DNS:<fully qualified domain name>, DNS:localhost
Certificate is to be certified until Feb 22 08:34:12 2025 GMT (375 days)    # (as specified in the -days option)
Sign the certificate? [y/n]: <y>


1 out of 1 certificate requests certified, commit? [y/n] <y>
Write out database with 1 new entries
Data Base Updated
1 This refers to the pass phrase specified when Creating the private key for the Certificate Authority

Verifying the Certificate

Verify the client certificate using the 'openssl x509' command:

PS> openssl x509 `
        -noout `
        -text `
        -in requesting-party/certs/TheGrantedCertificate.pem `
Details

In this command …​

  • -noout - prevents any other output than '-text'

  • -text - prints out the certificate in text form.

  • -in - specifies the certificate file which is displayed; here: certs/TheGrantedCertificate.pem `

For further options of the 'x509' command see the OpenSSL documentation.

Check the output for the right Issuer (i.e. the Certificate Authority) and X509v3 extensions.

Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 4103 (0x1007)
        Signature Algorithm: sha256WithRSAEncryption
        Issuer: C=DE, ST=NRW, L=Cologne, O=TheCompany, OU=IT, CN=TheCompany.com, emailAddress=it@thecompany.com
        Validity
            Not Before: Feb 13 08:34:12 2024 GMT
            Not After : Feb 22 08:34:12 2025 GMT
        Subject: C=DE, ST=NRW, L=Cologne, O=TheRequestingCompany, OU=Requester, CN=TheCompany.com, emailAddress=requester@thecompany.com
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (2048 bit)
                Modulus:
                    00:d9:05:a2:d7:e3:bb:0e:bd:26:f5:60:49:5d:a0:
                    93:03:e8:5b:9d:0d:e4:8b:d3:03:15:7d:50:4c:6f:
                    13:f3:83:76:d6:43:01:ac:8d:dc:b0:2d:fe:40:ae:
                    e7:f9:0c:03:5a:72:24:b5:e9:d7:7b:76:eb:6f:c6:
                    81:34:d0:56:a8:6a:d1:da:17:65:59:1f:9e:d6:6e:
                    d7:d0:60:9b:c3:2e:da:fc:05:98:9a:27:17:4c:6b:
                    74:5c:aa:69:1f:fe:73:15:c4:12:bc:ff:0e:75:42:
                    c8:96:bf:84:72:36:3a:95:02:b4:bb:e3:24:ae:e8:
                    82:4a:c9:8e:02:e7:bb:36:0b:c4:01:7d:de:ab:56:
                    a8:cf:f3:e9:89:3e:62:07:dc:29:5e:e3:ed:3f:fd:
                    0a:d5:cf:4c:9c:d3:bd:26:d7:0e:92:11:84:0e:92:
                    ab:91:eb:d1:23:24:70:a6:ee:2b:2b:e3:56:5c:92:
                    2a:96:26:dd:37:59:ed:06:f4:d3:fd:5d:cc:91:62:
                    33:ba:2c:1a:7c:0b:e2:9e:64:61:f7:cf:d7:8a:7c:
                    9c:5f:e3:0d:93:73:c1:f9:11:f6:d3:69:6e:79:c9:
                    23:35:6c:03:21:f9:b1:85:a1:b6:fc:d5:ae:ce:09:
                    f4:40:50:e7:31:f6:a1:ca:d0:61:11:02:31:4c:57:
                    ad:b7
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            X509v3 Basic Constraints:
                CA:FALSE
            Netscape Cert Type:
                SSL Client
            Netscape Comment:
                OpenSSL Generated Client Certificate
            X509v3 Subject Key Identifier:
                4B:47:2B:BE:9C:2B:95:22:73:10:6C:63:28:D3:C5:AE:F8:E3:FF:E7
            X509v3 Authority Key Identifier:
                40:CB:5E:C0:5E:30:BC:C9:56:6F:64:3D:11:34:86:B0:D7:7E:E1:C6
            X509v3 Key Usage: critical
                Digital Signature, Non Repudiation, Key Encipherment, Data Encipherment
            X509v3 Extended Key Usage:
                TLS Web Client Authentication
            X509v3 Subject Alternative Name:
                URI:urn:MYHOST:MYCOMPANY:AspenTech Inmation OT DataFabric
    Signature Algorithm: sha256WithRSAEncryption
    Signature Value:
        4b:7d:0a:06:1f:3b:91:8e:72:2a:98:16:40:b2:84:b3:9f:15:
        5e:45:48:78:88:a7:07:64:71:f3:05:2e:df:2a:cb:68:a4:8c:
        3e:8f:98:da:24:8e:f6:79:93:3a:03:1f:fb:4c:4e:20:dd:7e:
        a5:b9:f5:7b:cd:86:e9:3e:83:bf:41:0f:62:b9:2c:2f:6d:77:
        6c:4e:1c:2c:97:1b:5a:b1:86:f6:7d:13:82:3e:79:9e:4c:08:
        20:e4:63:33:ae:ee:82:5c:8d:f8:2f:4e:04:f7:d7:e4:8a:50:
        9d:07:6c:1e:60:1e:44:71:ae:79:d7:d7:dd:84:4b:c5:cf:07:
        f0:45:cc:cd:50:b0:4a:b1:2c:de:13:c2:78:91:e9:93:bc:2e:
        64:8a:ae:d5:86:7b:44:d5:fb:e2:7e:62:fe:2e:46:ea:f7:73:
        7d:d9:1a:41:c4:c4:dd:a9:e7:69:95:e5:84:ca:ff:62:21:ed:
        9e:5d:34:f7:1e:4b:d8:56:f0:d0:ff:e6:6f:f5:c8:ae:c5:72:
        56:6e:00:2b:09:ee:c0:b3:71:3d:13:0e:22:f8:e7:7e:56:32:
        47:b5:e5:0e:45:d6:b4:83:be:b2:08:d9:63:8a:59:d1:0e:49:
        76:83:aa:2c:c5:29:7f:31:56:bc:f4:1f:39:1b:d0:57:89:67:
        7c:e5:d2:17

Deploying the Signed Certificate

A third-party CA would now deploy the signed certificate to the requesting party. When acting as our own CA (as in this example), you simply know where to find the newly signed certificate. But for clarity’s sake, you can simulate the deployment by copying the certificate into the requesting-party\certs folder:

PS>  Copy-Item -Path ".\certificate-authority\signedcerts\TheGrantedCertificate.pem" -Destination ".\requesting-party\certs\"

Continue Reading

Now the certificate can be