A .NET global tool for decrypting ASP.NET Core cookies.
- Decode URL-encoded and base64-encoded cookies
- Decrypt ASP.NET Core authentication cookies using data protection keys
- Easy-to-use command-line interface
- Support for both decoding and decryption operations
To install the latest preview version:
dotnet tool install --global Dotnet.DeCookie --version 0.1.0-preview.1To install from a local build:
dotnet tool install --global --add-source ./nupkg Dotnet.DeCookiedotnet-decookie --cookie "your_cookie_value" --app-name "YourAppName"dotnet-decookie --cookie "your_cookie_value" --key "/path/to/key.xml" --app-name "YourAppName"The key file is typically found in:
- Windows:
%LOCALAPPDATA%\ASP.NET\DataProtection-Keys - Linux:
~/.aspnet/DataProtection-Keys - macOS:
/Users/your_user/.aspnet/DataProtection-Keys
The application name is required and must match the one used by your ASP.NET Core application for data protection. This ensures that the tool can correctly decrypt cookies created by your application.
# Example with explicit application name
dotnet-decookie --cookie "your_cookie_value" --key "/path/to/key.xml" --app-name "YourAppName"A sample ASP.NET Core project is included in the samples/CookieSample directory. This project demonstrates:
- Creating protected cookies using ASP.NET Core's Data Protection
- Retrieving raw cookie values
- Decrypting cookies using both the sample app and the Dotnet.DeCookie tool
To try it out:
- Run the sample project:
cd samples/CookieSample
dotnet run- Create a test cookie:
curl http://localhost:5000/Cookie/create- Use the returned cookie value and key location with the Dotnet.DeCookie tool.
See the sample project's README for more details.
git clone https://github.com/yourusername/dotnet-cookie-toolkit.git
cd dotnet-cookie-toolkit
dotnet build
dotnet packThis is a preview version (0.1.0-preview.1). While functional, it may contain bugs or incomplete features. Please report any issues you encounter.
MIT
Powered by Cursor - The AI-first Code Editor