Skip to content

Commit b74761b

Browse files
authored
Merge pull request #461 from GridProtectionAlliance/VerifyLocalCertificatePrivateKey
Added protected VerifyLocalCertificatePrivateKey to GSF.TimeSeries.ServiceHostBase
2 parents db2a831 + 258714e commit b74761b

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Source/Libraries/GSF.TimeSeries/ServiceHostBase.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,11 @@ public ServiceHostBase(IContainer container) : this() =>
220220
/// </summary>
221221
protected ConfigurationType ConfigurationType { get; private set; }
222222

223+
/// <summary>
224+
/// Gets or sets flag that determines if the local certificate's private key should be verified upon service start.
225+
/// </summary>
226+
protected bool VerifyLocalCertificatePrivateKey { get; set; } = true;
227+
223228
#endregion
224229

225230
#region [ Methods ]
@@ -774,7 +779,12 @@ private void GenerateLocalCertificate()
774779
};
775780

776781
if (File.Exists(certificatePath))
777-
certificate = new X509Certificate2(certificatePath);
782+
{
783+
if (VerifyLocalCertificatePrivateKey)
784+
certificate = new X509Certificate2(certificatePath);
785+
else
786+
return;
787+
}
778788

779789
if (Equals(certificate, certificateGenerator.GenerateCertificate()))
780790
return;

0 commit comments

Comments
 (0)