public object Create() { var caKey = _certificateService.GenerateRsaKeyPair(2048); var cert = _certificateService.Generate(new X509Name("CN=Charlie"), caKey.Private, caKey.Public); var pkcs1Key = _certificateService.Pkcs1Key(caKey); var pkcs8Key = _certificateService.Pkcs8Key(caKey); return(new { Cert = Convert.ToBase64String(cert.GetEncoded()), Pkcs1Key = pkcs1Key.PrivateKey, Pkcs8Key = pkcs8Key.PrivateKey }); }
public async Task <CreateCertificateResult> Handle(CreateCertificateCommand request, CancellationToken cancellationToken) => _certificateService.Generate(request);