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 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 }); } }