Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Certificates.cs
1using System.IO;
2using System.Reflection;
3using System.Security.Cryptography.X509Certificates;
5
7{
11 public static class Certificates
12 {
19 public static X509Certificate2 LoadCertificate(string ResourceName)
20 {
21 return LoadCertificate(ResourceName, Types.GetAssemblyForResource(ResourceName));
22 }
23
31 public static X509Certificate2 LoadCertificate(string ResourceName, Assembly Assembly)
32 {
33 return LoadCertificate(ResourceName, null, Assembly);
34 }
35
43 public static X509Certificate2 LoadCertificate(string ResourceName, string Password)
44 {
45 return LoadCertificate(ResourceName, Password, Types.GetAssemblyForResource(ResourceName));
46 }
47
56 public static X509Certificate2 LoadCertificate(string ResourceName, string Password, Assembly Assembly)
57 {
58 byte[] Data = Runtime.IO.Resources.LoadResource(ResourceName, Assembly);
59 if (Password is null)
60 return new X509Certificate2(Data);
61 else
62 return new X509Certificate2(Data, Password);
63 }
64 }
65}
Static class managing certificate resources.
Definition: Certificates.cs:12
static X509Certificate2 LoadCertificate(string ResourceName, string Password)
Loads a certificate from an embedded resource.
Definition: Certificates.cs:43
static X509Certificate2 LoadCertificate(string ResourceName, Assembly Assembly)
Loads a certificate from an embedded resource.
Definition: Certificates.cs:31
static X509Certificate2 LoadCertificate(string ResourceName, string Password, Assembly Assembly)
Loads a certificate from an embedded resource.
Definition: Certificates.cs:56
static X509Certificate2 LoadCertificate(string ResourceName)
Loads a certificate from an embedded resource.
Definition: Certificates.cs:19
Static class that dynamically manages types and interfaces available in the runtime environment.
Definition: Types.cs:15
static Assembly GetAssemblyForResource(string ResourceName)
Gets the assembly corresponding to a given resource name.
Definition: Types.cs:1787