Page 1 of 1

Filezilla X509 certificate not loaded by X509Certificate C# class

Posted: 2018-05-01 19:20
by vduvernet
Hi,

(I've posted the question on MSDN too :
https://social.msdn.microsoft.com/Forum ... arpgeneral)

I've generated a certificate throw FileZilla FTP Server interface latest version (tried with both 1024 & 2048 bits).

But during .CER file load, an exception is thrown during call to CreateFromCertFile() :

'System.Security.Cryptography.CryptographicException' - "Impossible de trouver l'objet requis".

string filename = @"D:\certificate.cer";
if (File.Exists(filename))
{
try
{
X509Certificate cert = X509Certificate.CreateFromCertFile(filename);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
}

Does someone knows about it ?
Thanks,
Vincent

Re: Filezilla X509 certificate not loaded by X509Certificate C# class

Posted: 2018-05-01 21:30
by botg
FileZilla Server creates syntactically valid files certificates. Since Windows' cryptographic libraries used by .net are closed-source, only Microsoft can answer your question for certain.

Re: Filezilla X509 certificate not loaded by X509Certificate C# class

Posted: 2018-05-02 07:25
by vduvernet
Hi,

I had an answer from MSDN.
the X509Certificate class support only ASN.1 DER :
https://msdn.microsoft.com/fr-fr/librar ... 2147217396

So, what is Filezilla version ?

Vincent

Re: Filezilla X509 certificate not loaded by X509Certificate C# class

Posted: 2018-05-02 09:20
by botg
It's in PEM format. Basically just base64 encoded DER enclosed in begin and end lines.