Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
26 lines (25 sloc) 672 Bytes
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace ASPNetCoreJWTSample.Controllers
{
[Route("api/[controller]/[action]")]
[ApiController]
public class KeyGenController : ControllerBase
{
[HttpGet]
public IActionResult GenerateKey()
{
using (var rng = new RNGCryptoServiceProvider())
{
var key = new byte[64];
rng.GetBytes(key);
return Ok(Convert.ToBase64String(key));
}
}
}
}
You can’t perform that action at this time.