# Support for Elliptic Curve Cryptography (ECC) Certificates in Server and Client Applications The server and client applications now support encrypted communication using both the RSA and the ECC encryption algorithms. The following document tries to explain the changes in the configuration of the server and client applications needed to support ECC certificates as well as the well consacrated RSA certificates. The means by which client and server application security related configuration has been configured upto introducing the ECC certificates, is described in the section [Previous Client and Server application configuration supports only RSA certificates](###previous-client-and-server-application-configuration-supports-only-rsa-certificates). The new security related configuration of client and server applications is described in the section [New Client and Server application configuration support both RSA and ECC certificates](###new-client-and-server-application-configuration-support-both-rsa-and-ecc-certificates). The compatibility between the old and the new configuration of client and server applications is described in the section [Old Client and Server application configuration VS New Client and Server spplication configuration](###old-client-and-server-application-configuration-vs-new-client-and-server-spplication-configuration). The limitations of the support for ECC certificates are described in the section [Known Limitations](###known-limitations). ## Previous Client and Server application configuration supports only RSA certificates Up to now, the configuration supported encrypted communication using only the RSA encryption algorithm. That means that the server and client certificates were RSA certificates and there was just one RSA certificate per application needed to be configured. The XML tag which contained the RSA certificate to be configured was ``. This tag is still used for the RSA certificate configuration in backward compatibility mode as further described below: ```xml Directory %LocalApplicationData%/OPC Foundation/pki/own CN=Quickstart Reference Server, C=US, S=Arizona, O=OPC Foundation, DC=localhost .... ``` ## Previous Server application configuration supports only RSA certificates For Server applications the configuration of the RSA certificate involves also specifying the SecurityPolicies to be supported by the server: ```xml SignAndEncrypt_3 http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256 None_1 http://opcfoundation.org/UA/SecurityPolicy#None Sign_2 SignAndEncrypt_3 .... ``` ## New Client and Server application configuration support both RSA and ECC certificates With the newly introduced support for ECC certificates, the configuration of the server application has been extended to support both RSA and ECC certificates. The XML tag under which both the RSA and ECC certificates are configured is ``. The `` tag is still used for the RSA certificate configuration in backward compatibility mode, meaning that old server configurations are still supported, but they cannot simultaneously coexist. The new configuration of the server application is described below: ```xml Directory %LocalApplicationData%/OPC Foundation/pki/own CN=Quickstart Reference Server, C=US, S=Arizona, O=OPC Foundation, DC=localhost RsaSha256 Directory %LocalApplicationData%/OPC Foundation/pki/own CN=Quickstart Reference Server, C=US, S=Arizona, O=OPC Foundation, DC=localhost NistP256 Directory %LocalApplicationData%/OPC Foundation/pki/own CN=Quickstart Reference Server, C=US, S=Arizona, O=OPC Foundation, DC=localhost NistP384 Directory %LocalApplicationData%/OPC Foundation/pki/own CN=Quickstart Reference Server, C=US, S=Arizona, O=OPC Foundation, DC=localhost BrainpoolP256r1 Directory %LocalApplicationData%/OPC Foundation/pki/own CN=Quickstart Reference Server, C=US, S=Arizona, O=OPC Foundation, DC=localhost BrainpoolP384r1 .... ``` This layout of the configuration file allows the server to support both RSA and ECC certificates and allows the server to generate certificates of different types. The `` tag is used to specify the type of the certificate. The supported types are: - `RsaSha256` for RSA certificates - `NistP256` for ECC certificates with NIST P256 curve - `NistP384` for ECC certificates with NIST P384 curve - `BrainpoolP256r1` for ECC certificates with Brainpool P256r1 curve - `BrainpoolP384r1` for ECC certificates with Brainpool P384r1 curve Additionally, this layout enables the user to select a specific `` for each certificate. This is useful when the user wants to generate certificates with different ``s. ## New Server application configuration related to ECC certificates The Server applications can configure the supported SecurityPolicies in the same way as before, but now the SecurityPolicies can be configured for each ECC specific SecurityPolicyUri which is to be supported by the server: ```xml SignAndEncrypt_3 http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256 Sign_2 SignAndEncrypt_3 Sign_2 http://opcfoundation.org/UA/SecurityPolicy#ECC_nistP256 Sign_2 http://opcfoundation.org/UA/SecurityPolicy#ECC_nistP384 Sign_2 http://opcfoundation.org/UA/SecurityPolicy#ECC_brainpoolP256r1 Sign_2 http://opcfoundation.org/UA/SecurityPolicy#ECC_brainpoolP384r1 SignAndEncrypt_3 http://opcfoundation.org/UA/SecurityPolicy#ECC_nistP256 SignAndEncrypt_3 http://opcfoundation.org/UA/SecurityPolicy#ECC_nistP384 SignAndEncrypt_3 http://opcfoundation.org/UA/SecurityPolicy#ECC_brainpoolP256r1 SignAndEncrypt_3 http://opcfoundation.org/UA/SecurityPolicy#ECC_brainpoolP384r1 .... ``` With the introduction of ECC certificates, the `` section of the configuration file has been extended to support ECC specific SecurityPolicies. The ECC specific SecurityPolicies are the following: - `http://opcfoundation.org/UA/SecurityPolicy#ECC_nistP256` - `http://opcfoundation.org/UA/SecurityPolicy#ECC_nistP384` - `http://opcfoundation.org/UA/SecurityPolicy#ECC_brainpoolP256r1` - `http://opcfoundation.org/UA/SecurityPolicy#ECC_brainpoolP384r1` If ECC specific SecurityPolicies are specified in the `` section of the configuration file, then the server will need to support the corresponding ECC certificates configured in the `` section of the configuration file with the corresponding ``s, not having them configured will result in the server not being able to start. Since the UserIdentityToken is also encrypted using the RSA or ECC certificate depending on the active security policy or the specified `` of the ``, servers which intend to explicitly state which ECC encryption (if any) of the UserIdentity tokens is supported, should specify the supported `` in the `` section of the configuration file (as it has always been). The supported ``s are the same as the ones specified in the `` section of the configuration file. The following example shows how the server can specify the supported ``s for the UserIdentityTokens: ```xml Anonymous_0 UserName_1 UserName_1 http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256 ``` The `` tag can be ommited in the `` tag, in which case the active security policy is used for the encryption of the UserIdentityToken. That implies that there is a dependency between the `` and the `` sections of the configuration file, meaning that the ``s specified in the `` section should be a subset of the ``s specified in the `` section of the configuration file. A situation in which a `` is specified in the `` section of the configuration file, but it is not specified in the `` section of the configuration file is logically incorrect and produces an invalid configuration. ## "Old" Client and Server application configuration format VS "New" Client and Server application configuration format Client and server applications which use the "old" configuration, will continue to work as before, meaning that the server and client certificates will be RSA certificates and the `` tag will be used to configure the RSA certificate. Server applications will have no ECC security policies specified in the `` section of the configuration file. You should be aware that such applications will not be able to support ECC certificates therefore they will not be able to communicate with clients and servers which use ECC certificates. Client and server applications which use the "new" configuration, are be able to support both RSA and ECC certificates. Server and Client applications are be able to support both RSA and ECC security policies by using the `` tag to configure the RSA and ECC certificates. The `` section of the configuration file are still used to configure the supported security policies which include the new ECC policies. Additionally the `` section of the configuration file can be used to configure the supported security policies for the UserIdentityTokens which also include the new ECC policies. Combining the "old" and the "new" configuration formats is not supported. That means that the `` tag cannot be used in the same configuration file with the `` tag. ## Configure GDS for use with ECC Certificates To configure the Global Discovery Server for use with ECC Certificates the configuration needs to be updated. ```xml Default RsaSha256ApplicationCertificateType ``` Replace the `` node of the Default CertificateGroupConfiguration with the `` node. This allows the Certificate Group to have multiple CA Certificates for the different Certificate types. ```xml Default RsaSha256ApplicationCertificateType EccNistP256ApplicationCertificateType EccNistP384ApplicationCertificateType ``` The old Configuration format is still supported but only supports either RSA or ECC Certificates for a single CertificateGroup. The GDS checks on startup if a valid configuration was supplied. ## Known Limitations Not all curves are supported by all OS platforms and not all .NET implementations offer cryptographic API support for all curve types. Due to these limitations, the support for ECC profiles is available starting with the following target platforms: .NET 4.8, .NET standard 2.1 and .NET 5 and above. The supported ECC curve types are the following: - `NistP256` for ECC certificates with NIST P256 curve - `NistP384` for ECC certificates with NIST P384 curve - `BrainpoolP256r1` for ECC certificates with Brainpool P256r1 curve - `BrainpoolP384r1` for ECC certificates with Brainpool P384r1 curve