Skip to content

Commit 493da5d

Browse files
authored
Extend ServerConfiguration & GDS Server for ECC (#2817)
* update ServerConfiguration Node to support multiple Application Certificates. Trust List Support for User Certificates & Https Certificates * GDS ready for ECC Step1 * fix test * fix build * ensure hash algorithm is set * update configurations to new format, fix minor ecc bugs * implicitly set certificate type of certificate identifier extend CertificateFactory to allow Revocation with ECC Issuer Certificate * Revert "update configurations to new format, fix minor ecc bugs" This reverts commit 9ee17f3. * Allow GDS Certificate Group to have multiple CA Certificates with different Certificate Types * fix minor bugs * adress review feedback * fix some issues * fix creation of CA signed ECC Certificates * Update configurations to new ApplicationCertificateFormat and add extra CA Certificates for ECC Certificates * remove brainpool certs from configuration * Generate ECC Certificates in Client Tests * Revert "Generate ECC Certificates in Client Tests" This reverts commit 90b395f. * fix crl tests on platforms not supporting ECC * fix crl test * Update READMEs for ECC
1 parent 4a44238 commit 493da5d

25 files changed

+605
-226
lines changed

Docs/EccProfiles.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,41 @@ Additionally the `<UserTokenPolicies>` section of the configuration file can be
237237
Combining the "old" and the "new" configuration formats is not supported. That means that the `<ApplicationCertificate>` tag cannot be used in the same configuration file with the `<ApplicationCertificates>` tag.
238238

239239

240+
## Configure GDS for use with ECC Certificates
241+
242+
To configure the Global Discovery Server for use with ECC Certificates the configuration needs to be updated.
243+
244+
```xml
245+
<Extensions>
246+
<ua:XmlElement>
247+
<GlobalDiscoveryServerConfiguration xmlns="http://opcfoundation.org/UA/GDS/Configuration.xsd">
248+
<CertificateGroups>
249+
<CertificateGroupConfiguration>
250+
<Id>Default</Id>
251+
<CertificateType>RsaSha256ApplicationCertificateType</CertificateType>
252+
```
253+
254+
Replace the `<CertificateType>` node of the Default CertificateGroupConfiguration with the `<CertificateTypes>` node.
255+
This allows the Certificate Group to have multiple CA Certificates for the different Certificate types.
256+
257+
```xml
258+
<Extensions>
259+
<ua:XmlElement>
260+
<GlobalDiscoveryServerConfiguration xmlns="http://opcfoundation.org/UA/GDS/Configuration.xsd">
261+
<CertificateGroups>
262+
<CertificateGroupConfiguration>
263+
<Id>Default</Id>
264+
<CertificateTypes>
265+
<ua:String>RsaSha256ApplicationCertificateType</ua:String>
266+
<ua:String>EccNistP256ApplicationCertificateType</ua:String>
267+
<ua:String>EccNistP384ApplicationCertificateType</ua:String>
268+
</CertificateTypes>
269+
```
270+
271+
The old Configuration format is still supported but only supports either RSA or ECC Certificates for a single CertificateGroup.
272+
The GDS checks on startup if a valid configuration was supplied.
273+
274+
240275
## Known Limitations
241276

242277
Not all curves are supported by all OS platforms and not all .NET implementations offer cryptographic API support for all curve types.
@@ -249,4 +284,6 @@ The supported ECC curve types are the following:
249284
- `BrainpoolP384r1` for ECC certificates with Brainpool P384r1 curve
250285

251286

287+
288+
252289

Docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ UA Core stack related:
1111
* Support for the [TransferSubscriptions](TransferSubscription.md) service set.
1212
* Improved support for [Logging](Logging.md) with `ILogger` and `EventSource`.
1313
* Support for [WellKnownRoles & RoleBasedUserManagement](RoleBasedUserManagement.md).
14+
* Support for [ECC Certificates](Docs/EccProfiles.md).
1415

1516
Reference application related:
1617
* [Reference Client](../Applications/ConsoleReferenceClient/README.md) documentation for configuration of the console reference client using parameters.

Libraries/Opc.Ua.Configuration/ApplicationInstance.cs

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -910,44 +910,18 @@ private static async Task<X509Certificate2> CreateApplicationInstanceCertificate
910910
#if !ECC_SUPPORT
911911
throw new ServiceResultException(StatusCodes.BadConfigurationError, "The Ecc certificate type is not supported.");
912912
#else
913-
ECCurve curve = default(ECCurve);
914-
if (id.CertificateType == ObjectTypeIds.EccApplicationCertificateType ||
915-
id.CertificateType == ObjectTypeIds.EccNistP256ApplicationCertificateType)
916-
{
917-
curve = ECCurve.NamedCurves.nistP256;
918-
}
919-
else if (id.CertificateType == ObjectTypeIds.EccNistP384ApplicationCertificateType)
920-
{
921-
curve = ECCurve.NamedCurves.nistP384;
922-
}
923-
else if (id.CertificateType == ObjectTypeIds.EccBrainpoolP256r1ApplicationCertificateType)
924-
{
925-
curve = ECCurve.NamedCurves.brainpoolP256r1;
926-
}
927-
else if (id.CertificateType == ObjectTypeIds.EccBrainpoolP384r1ApplicationCertificateType)
928-
{
929-
curve = ECCurve.NamedCurves.brainpoolP384r1;
930-
}
931-
#if CURVE25519
932-
else if (id.CertificateType == ObjectTypeIds.EccCurve25519ApplicationCertificateType)
933-
{
934-
curve = default(ECCurve);
935-
}
936-
else if (id.CertificateType == ObjectTypeIds.EccCurve448ApplicationCertificateType)
937-
{
938-
curve = default(ECCurve);
939-
}
940-
#endif
941-
else
913+
ECCurve? curve = EccUtils.GetCurveFromCertificateTypeId(id.CertificateType);
914+
915+
if(curve == null)
942916
{
943-
throw new ServiceResultException(StatusCodes.BadConfigurationError, "The ECC certificate type is not supported.");
917+
throw new ServiceResultException(StatusCodes.BadConfigurationError, "The Ecc certificate type is not supported.");
944918
}
945919

946920
id.Certificate = builder
947-
.SetECCurve(curve)
921+
.SetECCurve(curve.Value)
948922
.CreateForECDsa();
949923

950-
Utils.LogCertificate("Certificate created for {0}.", id.Certificate, curve.Oid.FriendlyName);
924+
Utils.LogCertificate("Certificate created for {0}.", id.Certificate, curve.Value.Oid.FriendlyName);
951925
#endif
952926
}
953927

@@ -1163,7 +1137,7 @@ private static async Task<bool> ApproveMessageAsync(string message, bool silent)
11631137
return false;
11641138
}
11651139
}
1166-
#endregion
1140+
#endregion
11671141

11681142
#region Private Fields
11691143
private string m_applicationName;

0 commit comments

Comments
 (0)