espenrl / erl.aspnetcore.authentication.clientcertificate Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
The description field accepts characters that cause an unhandled exception when generating a certificate.
Error: "The string contains an invalid X500 name, attribute key, OID, value or delimiter"
--
To avoid this error, create a new certificate and verify that there are no special characters inany of the fields in the distinguished name. In particular, do not include a comma in the company name.The following characters are not allowed in any of the CSR fields:[! @ # $ % ^ * ( ) ~ ? > < & / \ , . " ']
Input
{
"Description":"very loooooooooooong description for this certificate, how does it look",
"Role":"ClientCertificateManager",
"Password":"123",
"ValidForMonths":12
}
Return from server
Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException: The string contains an invalid X500 name attribute key, oid, value or delimiter.
at Internal.Cryptography.Pal.X509Pal.X500DistinguishedNameEncode(String distinguishedName, X500DistinguishedNameFlags flag)
at System.Security.Cryptography.X509Certificates.X500DistinguishedName.Encode(String distinguishedName, X500DistinguishedNameFlags flags)
at System.Security.Cryptography.X509Certificates.X500DistinguishedName..ctor(String distinguishedName, X500DistinguishedNameFlags flag)
at System.Security.Cryptography.X509Certificates.CertificateRequest..ctor(String subjectName, ECDsa key, HashAlgorithmName hashAlgorithm)
at erl.AspNetCore.Authentication.ClientCertificate.DefaultCertificateGenerator.GenerateCertificate(String subjectName, String friendlyName, DateTime notBefore, DateTime notAfter) in C:\Users\peder\Documents\Projects\CertificateAuthentication\erl.AspNetCore.Authentication.ClientCertificate\DefaultCertificateGenerator.cs:line 16
at erl.AspNetCore.Authentication.ClientCertificate.ClientCertificateController.<>c__DisplayClass9_0.<Generate>b__0() in C:\Users\peder\Documents\Projects\CertificateAuthentication\erl.AspNetCore.Authentication.ClientCertificate\ClientCertificateController.cs:line 264
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.<>c.<.cctor>b__274_0(Object obj)
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location where exception was thrown ---
at erl.AspNetCore.Authentication.ClientCertificate.ClientCertificateController.Generate(GenerateCertificateModel model) in C:\Users\peder\Documents\Projects\CertificateAuthentication\erl.AspNetCore.Authentication.ClientCertificate\ClientCertificateController.cs:line 263
at lambda_method(Closure , Object )
at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Errors are ignored when controller actions fails.
ApiController
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.