Share via

Unknown format in Input when creating X509Certificate2?

Benjamin Salerno 6 Reputation points
2021-09-21T19:31:06.32+00:00

I am attempting to create a X509CertificateCollection to use for validating my Nest client for ElasticSearch. I am attempting to create the first certificate like this:

private static readonly string Certificate = "mycert.cert";
private static X509Certificate2 cert = new X509Certificate2(Certificate);

However this is giving me the error

Interop.AppleCrypto.AppleCommonCryptoCryptographicException : Unknown format in import.

This is confusing me because having checked the documentation I thought I could create a X509Certificate using a file path. What am I doing wrong and how can I fix this issue?

Developer technologies | C#
Developer technologies | C#

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.

0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.