Skip to content
Merged
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
37 changes: 37 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet
{
"name": "C# (.NET)",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/dotnet:1-8.0-bookworm",
"features": {
"ghcr.io/devcontainers/features/dotnet:2": {}
},

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [5000, 5001],
// "portsAttributes": {
// "5001": {
// "protocol": "https"
// }
// }

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "dotnet restore",

// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"ms-dotnettools.csdevkit",
"GitHub.copilot-chat"
]
}
}

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot

version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net8.0</TargetFrameworks>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>

<EnableWindowsTargeting>true</EnableWindowsTargeting>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<OutputType>WinExe</OutputType>
<TargetFrameworks>net8.0-windows</TargetFrameworks>
<UseWPF>true</UseWPF>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Properties\AssemblyInfo.cs" />
Expand Down
6 changes: 6 additions & 0 deletions src/Titanium.Web.Proxy/Certificates/CertificateManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ public enum CertificateEngine
/// </summary>
BouncyCastle = 0,

/// <summary>
/// Uses BouncyCastle 3rd party library.
/// Observed to be faster than BouncyCastle.
/// </summary>
BouncyCastleFast = 2,

/// <summary>
Expand Down Expand Up @@ -279,6 +283,7 @@ public ICertificateCache CertificateStorage
/// </summary>
public bool DisableWildCardCertificates { get; set; } = false;

/// <inheritdoc />
public void Dispose()
{
Dispose(true);
Expand Down Expand Up @@ -951,6 +956,7 @@ private void Dispose(bool disposing)
disposed = true;
}

/// <inheritdoc />
~CertificateManager()
{
Dispose(false);
Expand Down
132 changes: 132 additions & 0 deletions src/Titanium.Web.Proxy/Certificates/Makers/WinCertificateMaker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,42 +305,174 @@ private X509Certificate2 MakeCertificate(string subject, string fullSubject,

#pragma warning restore

/// <summary>
/// The EncodingType enumeration represents the different encoding types that can be used when creating a certificate.
/// </summary>
public enum EncodingType
{
/// <summary>
/// Represents any encoding type.
/// </summary>
XcnCryptStringAny = 7,

/// <summary>
/// Represents Base64 encoding.
/// </summary>
XcnCryptStringBase64 = 1,

/// <summary>
/// Represents any Base64 encoding.
/// </summary>
XcnCryptStringBase64Any = 6,

/// <summary>
/// Represents Base64 encoding with a header.
/// </summary>
XcnCryptStringBase64Header = 0,

/// <summary>
/// Represents Base64 encoding with a request header.
/// </summary>
XcnCryptStringBase64Requestheader = 3,

/// <summary>
/// Represents Base64 encoding for URIs.
/// </summary>
XcnCryptStringBase64Uri = 13,

/// <summary>
/// Represents Base64 encoding with a X509 CRL header.
/// </summary>
XcnCryptStringBase64X509Crlheader = 9,

/// <summary>
/// Represents binary encoding.
/// </summary>
XcnCryptStringBinary = 2,

/// <summary>
/// Represents chain encoding.
/// </summary>
XcnCryptStringChain = 0x100,

/// <summary>
/// Represents the encode mask.
/// </summary>
XcnCryptStringEncodemask = 0xff,

/// <summary>
/// Represents hash data encoding.
/// </summary>
XcnCryptStringHashdata = 0x10000000,

/// <summary>
/// Represents hexadecimal encoding.
/// </summary>
XcnCryptStringHex = 4,

/// <summary>
/// Represents any hexadecimal encoding.
/// </summary>
XcnCryptStringHexAny = 8,

/// <summary>
/// Represents hexadecimal address encoding.
/// </summary>
XcnCryptStringHexaddr = 10,

/// <summary>
/// Represents hexadecimal ASCII encoding.
/// </summary>
XcnCryptStringHexascii = 5,

/// <summary>
/// Represents hexadecimal ASCII address encoding.
/// </summary>
XcnCryptStringHexasciiaddr = 11,

/// <summary>
/// Represents raw hexadecimal encoding.
/// </summary>
XcnCryptStringHexraw = 12,

/// <summary>
/// Represents encoding with no carriage return.
/// </summary>
XcnCryptStringNocr = -2147483648,

/// <summary>
/// Represents encoding with no CRLF.
/// </summary>
XcnCryptStringNocrlf = 0x40000000,

/// <summary>
/// Represents percent escape encoding.
/// </summary>
XcnCryptStringPercentescape = 0x8000000,

/// <summary>
/// Represents strict encoding.
/// </summary>
XcnCryptStringStrict = 0x20000000,

/// <summary>
/// Represents text encoding.
/// </summary>
XcnCryptStringText = 0x200
}

/// <summary>
/// The AlternativeNameType enumeration represents the different types of alternative names that can be used in a certificate.
/// </summary>
public enum AlternativeNameType
{
/// <summary>
/// Represents a directory name.
/// </summary>
XcnCertAltNameDirectoryName = 5,

/// <summary>
/// Represents a DNS name.
/// </summary>
XcnCertAltNameDnsName = 3,

/// <summary>
/// Represents a GUID.
/// </summary>
XcnCertAltNameGuid = 10,

/// <summary>
/// Represents an IP address.
/// </summary>
XcnCertAltNameIpAddress = 8,

/// <summary>
/// Represents an other name.
/// </summary>
XcnCertAltNameOtherName = 1,

/// <summary>
/// Represents a registered ID.
/// </summary>
XcnCertAltNameRegisteredId = 9,

/// <summary>
/// Represents an RFC 822 name.
/// </summary>
XcnCertAltNameRfc822Name = 2,

/// <summary>
/// Represents an unknown name type.
/// </summary>
XcnCertAltNameUnknown = 0,

/// <summary>
/// Represents a URL.
/// </summary>
XcnCertAltNameUrl = 7,

/// <summary>
/// Represents a user principle name.
/// </summary>
XcnCertAltNameUserPrincipleName = 11
}
8 changes: 8 additions & 0 deletions src/Titanium.Web.Proxy/EventArguments/SessionEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,14 @@ public bool ReRequest
}
}

/// <summary>
/// WebSocket decoder for sending data to server
/// </summary>
public WebSocketDecoder WebSocketDecoderSend => webSocketDecoderSend ??= new WebSocketDecoder(BufferPool);

/// <summary>
/// WebSocket decoder for receiving data from server
/// </summary>
public WebSocketDecoder WebSocketDecoderReceive => webSocketDecoderReceive ??= new WebSocketDecoder(BufferPool);

/// <summary>
Expand Down Expand Up @@ -611,6 +617,7 @@ public void TerminateServerConnection()
HttpClient.CloseServerConnection = true;
}

/// <inheritdoc/>
protected override void Dispose(bool disposing)
{
if (disposed) return;
Expand All @@ -621,6 +628,7 @@ protected override void Dispose(bool disposing)
base.Dispose(disposing);
}

/// <inheritdoc/>
~SessionEventArgs()
{
#if DEBUG
Expand Down
Loading