aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2015-12-29 12:15:19 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2015-12-29 12:15:19 -0500
commit2f75af85638284e32e695694db68c11b5061accf (patch)
treead9976bf5b3cef0ccb45f4885edfbcd3336216ea
parentfc1faa65d4e5cc0b4674f15c148c02cddc52aa19 (diff)
update ValidateSslCertificate
-rw-r--r--MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs23
1 files changed, 5 insertions, 18 deletions
diff --git a/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs b/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs
index f8266a43f..2f4c3f5ee 100644
--- a/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs
+++ b/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs
@@ -188,28 +188,15 @@ namespace MediaBrowser.Server.Implementations.Configuration
{
var serverConfig = (ServerConfiguration)newConfig;
- var certPath = serverConfig.CertificatePath;
+ var newPath = serverConfig.CertificatePath;
- if (!string.IsNullOrWhiteSpace(certPath))
+ if (!string.IsNullOrWhiteSpace(newPath)
+ && !string.Equals(Configuration.CertificatePath ?? string.Empty, newPath))
{
// Validate
- if (!File.Exists(certPath))
- {
- throw new FileNotFoundException(string.Format("Certificate file '{0}' does not exist.", certPath));
- }
-
- try
- {
- var cert = new System.Security.Cryptography.X509Certificates.X509Certificate2(certPath);
-
- if (cert.PrivateKey == null)
- {
- throw new ArgumentException("Certificate does not contain a private key!");
- }
- }
- catch (Exception ex)
+ if (!FileSystem.FileExists(newPath))
{
- throw new ArgumentException(string.Format("Exception loading certificate: '{0}' - {1}", certPath, ex.Message));
+ throw new FileNotFoundException(string.Format("Certificate file '{0}' does not exist.", newPath));
}
}
}