transactions
This commit is contained in:
21
back/controllers/CryptoController.cs
Normal file
21
back/controllers/CryptoController.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using back.services.engine.Crypto;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Net;
|
||||
|
||||
namespace back.controllers;
|
||||
|
||||
[ApiController, Route("api/[controller]")]
|
||||
public class CryptoController(ICryptoService cryptoService) : ControllerBase
|
||||
{
|
||||
[HttpGet("[action]")] public async Task<IActionResult> RSA([FromHeader(Name = "X-client-thumbprint")] string clientId)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(clientId))
|
||||
{
|
||||
return BadRequest("Client ID is required.");
|
||||
}
|
||||
var key = cryptoService.GetPublicCertificate(clientId);
|
||||
if (key == null)
|
||||
return StatusCode((int)HttpStatusCode.InternalServerError, "Failed to generate RSA keys.");
|
||||
return Ok(new { PublicKey = key });
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user