mirror of
https://github.com/mm201/pkmn-classic-framework.git
synced 2026-04-24 15:26:48 -05:00
Global terminal service will use a matching certificate from the store if it finds one.
This commit is contained in:
parent
2761fe8577
commit
a6ff7912bc
|
|
@ -35,7 +35,7 @@ namespace PkmnFoundations.GlobalTerminalService
|
|||
// real point in securing it.
|
||||
public GTServerBase(int port, bool useSsl, int threads, int timeout)
|
||||
: this(port, useSsl, threads, timeout,
|
||||
useSsl ? new X509Certificate2(AppDomain.CurrentDomain.BaseDirectory + Path.DirectorySeparatorChar + "cert.pfx", "letmein") : null)
|
||||
useSsl ? GetDefaultCertificate() : null)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -49,6 +49,19 @@ namespace PkmnFoundations.GlobalTerminalService
|
|||
m_listener = new TcpListener(IPAddress.Any, port);
|
||||
}
|
||||
|
||||
private static X509Certificate2 GetDefaultCertificate()
|
||||
{
|
||||
X509Store store = new X509Store(StoreLocation.LocalMachine);
|
||||
store.Open(OpenFlags.ReadOnly);
|
||||
X509Certificate2Collection cers = store.Certificates.Find(X509FindType.FindBySubjectName, "pkgdsprod.nintendo.co.jp", false);
|
||||
|
||||
if (cers.Count > 0)
|
||||
return cers[0];
|
||||
|
||||
LogHelper.Write("X.509 certificate not found. Please add a certificate with subject \"pkgdsprod.nintendo.co.jp\" to the store. Using dummy certificate.");
|
||||
return new X509Certificate2(AppDomain.CurrentDomain.BaseDirectory + Path.DirectorySeparatorChar + "cert.pfx", "letmein");
|
||||
}
|
||||
|
||||
public int Threads
|
||||
{
|
||||
get;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user