Skip to content
This repository has been archived by the owner on Jul 9, 2023. It is now read-only.

Commit

Permalink
Merge pull request #736 from justcoding121/master
Browse files Browse the repository at this point in the history
beta
  • Loading branch information
honfika authored Jan 22, 2020
2 parents afff522 + 33d86a5 commit 1880a7d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/Titanium.Web.Proxy/Helpers/SystemProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,9 @@ private static void refresh()
/// <summary>
/// Opens the registry key with the internet settings
/// </summary>
private static RegistryKey openInternetSettingsKey()
private static RegistryKey? openInternetSettingsKey()
{
return Registry.CurrentUser.OpenSubKey(regKeyInternetSettings, true);
return Registry.CurrentUser?.OpenSubKey(regKeyInternetSettings, true);
}
}
}
22 changes: 7 additions & 15 deletions src/Titanium.Web.Proxy/Network/DefaultCertificateDiskCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@

namespace Titanium.Web.Proxy.Network
{
internal sealed class DefaultCertificateDiskCache : ICertificateCache
public sealed class DefaultCertificateDiskCache : ICertificateCache
{
private const string defaultCertificateDirectoryName = "crts";
private const string defaultCertificateFileExtension = ".pfx";
private const string defaultRootCertificateFileName = "rootCert" + defaultCertificateFileExtension;
private string? rootCertificatePath;
private string? certificatePath;

public X509Certificate2? LoadRootCertificate(string pathOrName, string password, X509KeyStorageFlags storageFlags)
{
Expand Down Expand Up @@ -56,8 +55,6 @@ public void Clear()
{
// do nothing
}

certificatePath = null;
}

private X509Certificate2? loadCertificate(string path, string password, X509KeyStorageFlags storageFlags)
Expand Down Expand Up @@ -95,20 +92,15 @@ private string getRootCertificatePath(string pathOrName)

private string getCertificatePath(bool create)
{
if (certificatePath == null)
{
string path = getRootCertificateDirectory();

string certPath = Path.Combine(path, defaultCertificateDirectoryName);
if (create && !Directory.Exists(certPath))
{
Directory.CreateDirectory(certPath);
}
string path = getRootCertificateDirectory();

certificatePath = certPath;
string certPath = Path.Combine(path, defaultCertificateDirectoryName);
if (create && !Directory.Exists(certPath))
{
Directory.CreateDirectory(certPath);
}

return certificatePath;
return certPath;
}

private string getRootCertificateDirectory()
Expand Down
20 changes: 20 additions & 0 deletions src/Titanium.Web.Proxy/StreamExtended/Models/SslCiphers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ internal static class SslCiphers
{ 0x00C4, "TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256" },
{ 0x00C5, "TLS_DH_anon_WITH_CAMELLIA_256_CBC_SHA256" },
{ 0x00FF, "TLS_EMPTY_RENEGOTIATION_INFO_SCSV" },
// RFC 8446
{ 0x1301, "TLS_AES_128_GCM_SHA256" },
{ 0x1302, "TLS_AES_256_GCM_SHA384" },
{ 0x1303, "TLS_CHACHA20_POLY1305_SHA256" },
{ 0x1304, "TLS_AES_128_CCM_SHA256" },
{ 0x1305, "TLS_AES_128_CCM_8_SHA256" },
{ 0x5600, "TLS_FALLBACK_SCSV" },
// RFC 4492
{ 0xC001, "TLS_ECDH_ECDSA_WITH_NULL_SHA" },
Expand Down Expand Up @@ -353,6 +359,15 @@ internal static class SslCiphers
{ 0xC0AD, "TLS_ECDHE_ECDSA_WITH_AES_256_CCM" },
{ 0xC0AE, "TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8" },
{ 0xC0AF, "TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8" },
{ 0xC0B0, "TLS_ECCPWD_WITH_AES_128_GCM_SHA256" },
{ 0xC0B1, "TLS_ECCPWD_WITH_AES_256_GCM_SHA384" },
{ 0xC0B2, "TLS_ECCPWD_WITH_AES_128_CCM_SHA256" },
{ 0xC0B3, "TLS_ECCPWD_WITH_AES_256_CCM_SHA384" },
{ 0xC0B4, "TLS_SHA256_SHA256" },
{ 0xC0B5, "TLS_SHA384_SHA384" },
{ 0xC100, "TLS_GOSTR341112_256_WITH_KUZNYECHIK_CTR_OMAC" },
{ 0xC101, "TLS_GOSTR341112_256_WITH_MAGMA_CTR_OMAC" },
{ 0xC102, "TLS_GOSTR341112_256_WITH_28147_CNT_IMIT" },
// old numbers used in the beginning http://tools.ietf.org/html/draft-agl-tls-chacha20poly1305
{ 0xCC13, "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256" },
{ 0xCC14, "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256" },
Expand All @@ -365,6 +380,11 @@ internal static class SslCiphers
{ 0xCCAC, "TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256" },
{ 0xCCAD, "TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256" },
{ 0xCCAE, "TLS_RSA_PSK_WITH_CHACHA20_POLY1305_SHA256" },
// RFC 8442
{ 0xD001, "TLS_ECDHE_PSK_WITH_AES_128_GCM_SHA256" },
{ 0xD002, "TLS_ECDHE_PSK_WITH_AES_256_GCM_SHA384" },
{ 0xD003, "TLS_ECDHE_PSK_WITH_AES_128_CCM_8_SHA256" },
{ 0xD005, "TLS_ECDHE_PSK_WITH_AES_128_CCM_SHA256" },
// http://tools.ietf.org/html/draft-josefsson-salsa20-tls
{ 0xE410, "TLS_RSA_WITH_ESTREAM_SALSA20_SHA1" },
{ 0xE411, "TLS_RSA_WITH_SALSA20_SHA1" },
Expand Down

0 comments on commit 1880a7d

Please sign in to comment.