Filezilla X509 certificate not loaded by X509Certificate C# class

Moderator: Project members

Post Reply
Message
Author
vduvernet
500 Syntax error
Posts: 12
Joined: 2008-03-24 18:39

Filezilla X509 certificate not loaded by X509Certificate C# class

#1 Post by vduvernet » 2018-05-01 19:20

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

User avatar
botg
Site Admin
Posts: 35507
Joined: 2004-02-23 20:49
First name: Tim
Last name: Kosse

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

#2 Post by botg » 2018-05-01 21:30

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.

vduvernet
500 Syntax error
Posts: 12
Joined: 2008-03-24 18:39

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

#3 Post by vduvernet » 2018-05-02 07:25

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

User avatar
botg
Site Admin
Posts: 35507
Joined: 2004-02-23 20:49
First name: Tim
Last name: Kosse

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

#4 Post by botg » 2018-05-02 09:20

It's in PEM format. Basically just base64 encoded DER enclosed in begin and end lines.

Post Reply