SecureFetch.AspNetCore 8.0.0

dotnet add package SecureFetch.AspNetCore --version 8.0.0
                    
NuGet\Install-Package SecureFetch.AspNetCore -Version 8.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SecureFetch.AspNetCore" Version="8.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SecureFetch.AspNetCore" Version="8.0.0" />
                    
Directory.Packages.props
<PackageReference Include="SecureFetch.AspNetCore" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SecureFetch.AspNetCore --version 8.0.0
                    
#r "nuget: SecureFetch.AspNetCore, 8.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SecureFetch.AspNetCore@8.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SecureFetch.AspNetCore&version=8.0.0
                    
Install as a Cake Addin
#tool nuget:?package=SecureFetch.AspNetCore&version=8.0.0
                    
Install as a Cake Tool

SecureFetch.AspNetCore (.NET)

SecureFetch.AspNetCore enables encrypted, obfuscated API access in ASP.NET Core using a middleware proxy approach.

NuGet Version NuGet Downloads

Features

  • 🔐 AES-256-CBC encrypted URLs and bodies using shared secret
  • 🎯 Middleware decrypts and forwards to actual controller routes
  • 🧩 Use [SecureFetch] attribute to mark endpoints as secure
  • 🪄 No changes to existing route logic or controllers
  • 🔁 Optional override of /secure base route

Installation

Install via NuGet Package Manager:

Install-Package SecureFetch.AspNetCore

Or via .NET CLI:

dotnet add package SecureFetch.AspNetCore

Usage

  1. Add the following to appsettings.json
{
    "SecureFetch":{
        "SharedSecret": "your-shared-secret",
        "BasePath": "/secure" // Optional, defaults to /secure"
    }
}
  1. Register services and middleware in Program.cs
using SecureFetch.AspNetCore;

var builder = WebApplication.CreateBuilder(args);
// Register SecureFetch services
builder.Services.AddSecureFetch(options =>
{
    options.SharedSecret = builder.Configuration["SecureFetch:Secret"] ?? "try-not-to-laugh"; // Do not explicitly write secret in code
    options.BasePath = builder.Configuration["SecureFetch:BasePath"] ?? "/secure";
});

// Ensure CORS is configured
builder.Services.AddCors(options =>
{
    options.AddPolicy("AllowAll", policy =>
    {
        policy.AllowAnyOrigin()
              .AllowAnyHeader()
              .AllowAnyMethod();
    });
});

builder.Services.AddControllers();

var app = builder.Build();
app.UseCors("AllowAll");
app.UseSecureFetch(); // Adds decryption + proxy middleware add at the beginning of the pipeline
app.UseRouting(); // Add routing middleware
app.UseAuthorization(); // Adds authorization middleware if needed
app.MapControllers();
app.Run();
  1. Decorate secure endpoints with [SecureFetch]

using Microsoft.AspNetCore.Mvc;
using SecureFetch.AspNetCore;

[ApiController]
[Route("api/[controller]")]
public class ValuesController : ControllerBase
{
    [HttpGet("{id}")]
    [SecureFetch]
    public IActionResult GetValue(int id)
    {
        return Ok(new { Id = id, Message = "This was securely fetched." });
    }

    [HttpPost]
    [SecureFetch]
    public IActionResult PostValue([FromBody] MyModel model)
    {
        return CreatedAtAction(nameof(GetValue), new { id = model.Id }, model);
    }

    [HttpGet("open")]
    public IActionResult OpenEndpoint() => Ok("No encryption required");
}

Your encrypted URL will then use:

http://localhost:5000/secure/{encrypted-string}

Author

Created and Maintained by: Ethern-Myth


Give a like to this project, Thanks.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
8.0.0 154 5/26/2025