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

beta #736

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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