none
Filezilla X509 certificate not loaded by X509Certificate class

    Question

  • Hi,

    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 anyone have an idea of the problem ?

    Thanks,

    Vincent

    Monday, April 30, 2018 9:45 PM

All replies

  • Hi Duvernet Vincent,

    Thank you for posting here.

    For your question, what is the format of your FileZilla FTP Server certificate?

    ASN.1 DER is the only certificate format supported by this X509Certificate class

    According to MSDN document, the byte array can be binary (DER) encoded or Base64-encoded X.509 data. The byte array can also be a PKCS7 (Authenticode) signed file; the signer certificate is used to create the object. Please try tp use X509Certificate2 Class.

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, May 2, 2018 7:21 AM
    Moderator
  • Hi,

    I had an answer from filezilla community https://forum.filezilla-project.org/viewtopic.php?p=162965#p162965:

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

    I'll try the X509Certificate2.

    Vincent

    Wednesday, May 2, 2018 9:40 AM