{"id":22351797,"url":"https://github.com/laget-se/laget.pskauthentication","last_synced_at":"2025-09-09T23:23:35.367Z","repository":{"id":38317346,"uuid":"319625112","full_name":"laget-se/laget.PskAuthentication","owner":"laget-se","description":"Generic implementation of Secure Pre-Shared Key (PSK) Authentication for laget.se using AES.","archived":false,"fork":false,"pushed_at":"2024-10-30T20:41:25.000Z","size":151,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-07-22T07:28:04.043Z","etag":null,"topics":["aes-encryption","authentication","nuget","psk"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/laget-se.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-08T12:00:04.000Z","updated_at":"2024-10-30T20:41:29.000Z","dependencies_parsed_at":"2023-11-22T16:07:13.765Z","dependency_job_id":"63ccf738-6c57-4e91-bb03-0ade08d2a714","html_url":"https://github.com/laget-se/laget.PskAuthentication","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/laget-se/laget.PskAuthentication","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laget-se%2Flaget.PskAuthentication","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laget-se%2Flaget.PskAuthentication/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laget-se%2Flaget.PskAuthentication/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laget-se%2Flaget.PskAuthentication/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/laget-se","download_url":"https://codeload.github.com/laget-se/laget.PskAuthentication/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laget-se%2Flaget.PskAuthentication/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266586905,"owners_count":23952205,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aes-encryption","authentication","nuget","psk"],"created_at":"2024-12-04T12:15:30.494Z","updated_at":"2025-07-22T23:03:39.250Z","avatar_url":"https://github.com/laget-se.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# laget.PskAuthentication\nGeneric implementation of Secure Pre-Shared Key (PSK) Authentication for laget.se using AES.\n\n![Nuget](https://img.shields.io/nuget/v/laget.PskAuthentication.Client?label=laget.PskAuthentication.Client)\n![Nuget](https://img.shields.io/nuget/dt/laget.PskAuthentication.Client?label=laget.PskAuthentication.Client)\n\n![Nuget](https://img.shields.io/nuget/v/laget.PskAuthentication.Core?label=laget.PskAuthentication.Core)\n![Nuget](https://img.shields.io/nuget/dt/laget.PskAuthentication.Core?label=laget.PskAuthentication.Core)\n\n![Nuget](https://img.shields.io/nuget/v/laget.PskAuthentication.Mvc?label=laget.PskAuthentication.Mvc)\n![Nuget](https://img.shields.io/nuget/dt/laget.PskAuthentication.Mvc?label=laget.PskAuthentication.Mvc)\n\n## Configuration\n\u003e This example is shown using Autofac since this is the go-to IoC for us.\n```c#\npublic class OptionModule : Module\n{\n    readonly IConfiguration _configuration;\n\n    public OptionModule(IConfiguration configuration)\n    {\n        _configuration = configuration;\n    }\n\n    protected override void Load(ContainerBuilder builder)\n    {\n        builder.Register(c =\u003e new PskAuthenticationAttribute(new PskAuthenticationOptions\n        {\n            Key = _configuration.GetValue\u003cstring\u003e(\"Security:Key\"),\n            IV = _configuration.GetValue\u003cstring\u003e(\"Security:IV\"),\n            Salt = _configuration.GetValue\u003cstring\u003e(\"Security:Salt\"),\n            Secret = _configuration.GetValue\u003cstring\u003e(\"Security:Secret\")\n        })).AsSelf();\n    }\n}\n```\n\n### appsettings.json\n```c#\n\"Security\": {\n  \"Key\": \"...\",\n  \"IV\": \"...\",\n  \"Salt\": \"...\",\n  \"Secret\": \"...\"\n}\n```\n\n## Usage\n### Controller\n```c#\n[PskAuthentication]\npublic class SomeController : ControllerBase\n{\n}\n```\n\n## Aes\nYou can generate the necessary Aes properties via the code below or visit https://rextester.com/RMKPPK46300\n\n```c#\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\nusing System.Security.Cryptography;\n    \nnamespace Rextester\n{\n    public class Program\n    {\n        public static void Main(string[] args)\n        {\n            var aes = Aes.Create();\n            aes.Mode = CipherMode.CBC;\n            aes.Padding = PaddingMode.PKCS7;\n            aes.GenerateIV();\n            aes.GenerateKey();\n            \n            Console.WriteLine(Convert.ToBase64String(aes.IV));\n            Console.WriteLine(Convert.ToBase64String(aes.Key));\n        }\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaget-se%2Flaget.pskauthentication","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaget-se%2Flaget.pskauthentication","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaget-se%2Flaget.pskauthentication/lists"}