@@ -604,20 +604,18 @@ public static bool RequireEncryption(EndpointDescription description)
604604 /// Sets the Server Certificate in an Endpoint description if the description requires encryption.
605605 /// </summary>
606606 /// <param name="description">the endpoint Description to set the server certificate</param>
607- /// <param name="sendCertificateChain">true if the certificate chain shall be sent</param>
608607 /// <param name="certificateTypesProvider">The provider to get the server certificate per certificate type.</param>
609608 /// <param name="checkRequireEncryption">only set certificate if the endpoint does require Encryption</param>
610609 public static void SetServerCertificateInEndpointDescription (
611610 EndpointDescription description ,
612- bool sendCertificateChain ,
613611 CertificateTypesProvider certificateTypesProvider ,
614612 bool checkRequireEncryption = true )
615613 {
616614 if ( ! checkRequireEncryption || RequireEncryption ( description ) )
617615 {
618616 X509Certificate2 serverCertificate = certificateTypesProvider . GetInstanceCertificate ( description . SecurityPolicyUri ) ;
619617 // check if complete chain should be sent.
620- if ( sendCertificateChain )
618+ if ( certificateTypesProvider . SendCertificateChain )
621619 {
622620 description . ServerCertificate = certificateTypesProvider . LoadCertificateChainRaw ( serverCertificate ) ;
623621 }
@@ -797,6 +795,22 @@ protected virtual EndpointBase GetEndpointInstance(ServerBase server)
797795 protected virtual void OnCertificateUpdate ( object sender , CertificateUpdateEventArgs e )
798796 {
799797 InstanceCertificateTypesProvider . Update ( e . SecurityConfiguration ) ;
798+
799+ foreach ( var certificateIdentifier in Configuration . SecurityConfiguration . ApplicationCertificates )
800+ {
801+ // preload chain
802+ X509Certificate2 certificate = certificateIdentifier . Find ( false ) . GetAwaiter ( ) . GetResult ( ) ;
803+ InstanceCertificateTypesProvider . LoadCertificateChainAsync ( certificate ) . GetAwaiter ( ) . GetResult ( ) ;
804+ }
805+
806+ //update certificate in the endpoint descriptions
807+ foreach ( EndpointDescription endpointDescription in m_endpoints )
808+ {
809+ SetServerCertificateInEndpointDescription (
810+ endpointDescription ,
811+ InstanceCertificateTypesProvider ) ;
812+ }
813+
800814 foreach ( var listener in TransportListeners )
801815 {
802816 listener . CertificateUpdate ( e . CertificateValidator , InstanceCertificateTypesProvider ) ;
@@ -1476,7 +1490,7 @@ protected virtual void ProcessRequest(IEndpointIncomingRequest request, object c
14761490 {
14771491 request . CallSynchronously ( ) ;
14781492 }
1479- #endregion
1493+ #endregion
14801494
14811495 #region RequestQueue Class
14821496 /// <summary>
@@ -1706,7 +1720,7 @@ private void OnProcessRequestQueue(object state)
17061720 }
17071721 }
17081722#endif
1709- #endregion
1723+ #endregion
17101724
17111725 #region Private Fields
17121726 private ServerBase m_server ;
@@ -1720,7 +1734,7 @@ private void OnProcessRequestQueue(object state)
17201734 private Queue < IEndpointIncomingRequest > m_queue ;
17211735 private int m_totalThreadCount ;
17221736#endif
1723- #endregion
1737+ #endregion
17241738
17251739 }
17261740 #endregion
0 commit comments