36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
using System.Security.Cryptography.X509Certificates;
|
|
|
|
namespace Kreta.EESZTInterface
|
|
{
|
|
public class CertificateHelper
|
|
{
|
|
private static readonly string binPath = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "bin");
|
|
|
|
public static X509Certificate2 GetSslCertificate()
|
|
{
|
|
return new X509Certificate2($@"{binPath}\Certs\eKRETA_prod.pfx", "9e=EH!2q");
|
|
}
|
|
|
|
public static X509Certificate2 GetSTSCertificate()
|
|
{
|
|
return new X509Certificate2($@"{binPath}\Certs\p_owsm.cer");
|
|
}
|
|
|
|
public static X509Certificate2 GetUserCertificate()
|
|
{
|
|
return new X509Certificate2($@"{binPath}.\Certs\userEles.pfx", "eKretaBudafoki");
|
|
}
|
|
|
|
public static string CertToBase64String(X509Certificate2 cert)
|
|
{
|
|
return System.Convert.ToBase64String(cert.RawData);
|
|
}
|
|
|
|
public static X509Certificate2 CertFromBase64String(string base64Encoded)
|
|
{
|
|
byte[] data = System.Convert.FromBase64String(base64Encoded);
|
|
var cert = new X509Certificate2(data);
|
|
return cert;
|
|
}
|
|
}
|
|
}
|