@@ -445,16 +445,16 @@ public void HasApplicationSecureAdminAccess(
445445 }
446446
447447 private async ValueTask < UpdateCertificateMethodStateResult > UpdateCertificateAsync (
448- ISystemContext context ,
449- MethodState method ,
450- NodeId objectId ,
451- NodeId certificateGroupId ,
452- NodeId certificateTypeId ,
453- byte [ ] certificate ,
454- byte [ ] [ ] issuerCertificates ,
455- string privateKeyFormat ,
456- byte [ ] privateKey ,
457- CancellationToken cancellation )
448+ ISystemContext context ,
449+ MethodState method ,
450+ NodeId objectId ,
451+ NodeId certificateGroupId ,
452+ NodeId certificateTypeId ,
453+ byte [ ] certificate ,
454+ byte [ ] [ ] issuerCertificates ,
455+ string privateKeyFormat ,
456+ byte [ ] privateKey ,
457+ CancellationToken cancellation )
458458 {
459459 bool applyChangesRequired = false ;
460460 HasApplicationSecureAdminAccess ( context ) ;
@@ -484,13 +484,11 @@ private async ValueTask<UpdateCertificateMethodStateResult> UpdateCertificateAsy
484484 }
485485
486486 privateKeyFormat = privateKeyFormat ? . ToUpper ( ) ;
487- if ( ! ( string . IsNullOrEmpty ( privateKeyFormat ) ||
488- privateKeyFormat == "PEM" ||
489- privateKeyFormat == "PFX" ) )
487+ if ( privateKeyFormat is not null and not "PEM" and not "PFX" and not "" )
490488 {
491489 throw new ServiceResultException (
492490 StatusCodes . BadNotSupported ,
493- "The private key format is not supported." ) ;
491+ $ "The private key format { privateKeyFormat } is not supported.") ;
494492 }
495493
496494 ServerCertificateGroup certificateGroup = VerifyGroupAndTypeId (
@@ -599,7 +597,7 @@ private async ValueTask<UpdateCertificateMethodStateResult> UpdateCertificateAsy
599597 case "" :
600598 {
601599 X509Certificate2 exportableKey ;
602- //use the new generated private key if one exists and matches the provided public key
600+ // use the new generated private key if one exists and matches the provided public key
603601 if ( certificateGroup . TemporaryApplicationCertificate != null &&
604602 X509Utils . VerifyKeyPair (
605603 newCert ,
@@ -635,7 +633,10 @@ private async ValueTask<UpdateCertificateMethodStateResult> UpdateCertificateAsy
635633 . CreateCertificateFromPKCS12 (
636634 privateKey ,
637635 passwordProvider ? . GetPassword ( existingCertIdentifier ) ,
638- true ) ;
636+ false ) ;
637+ // was: true - but changed to false
638+ // true introduced in https://github.com/OPCFoundation/UA-.NETStandard/commit/0b24d62b7c2bab2e5ed08e694103d49278e457af
639+ // CopyWithPrivateKey apparently does not support ephimeralkeysets but it seems to work.
639640 updateCertificate . CertificateWithPrivateKey =
640641 CertificateFactory . CreateCertificateWithPrivateKey (
641642 newCert ,
0 commit comments