using System.IO; namespace MQTTnet.Server.Configuration { public class CertificateSettingsModel { /// /// Path to certificate. /// public string Path { get; set; } /// /// Password of certificate. /// public string Password { get; set; } /// /// Read certificate file. /// public byte[] ReadCertificate() { if (string.IsNullOrEmpty(Path) || string.IsNullOrWhiteSpace(Path)) { throw new FileNotFoundException("No path set"); } if (!File.Exists(Path)) { throw new FileNotFoundException($"Could not find Certificate in path: {Path}"); } return File.ReadAllBytes(Path); } } }