EldoS | Feel safer!

Software components for data protection, secure storage and transfer

FTPs Server - Load multiple Certificates from one PFX File

Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.
#32580
Posted: 03/11/2015 03:35:07
by ITSG (Standard support level)
Joined: 06/27/2013
Posts: 34

Hi there,

is it possible to load several (in my case 3) certificates from one PFX File in the CERT Storage ? I am using the TElX509Certificate in TElSimpleFTPSServer
Works fine with one CERT, but we now have 3 (Intermediate, root, etc.)
Any ideas ? This is my code:
Code
using (certificateStream = new FileStream(certificatePath, FileMode.Open, FileAccess.Read))
                {
                    _ftpServer.CertStorage.Clear();
                    if (certificateStream.Length > 0)
                    {
                        var cert = new TElX509Certificate();
                        try
                        {
                            if ((cert.LoadFromStreamAuto(certificateStream, certificatePassword, (int)certificateStream.Length) == 0) && (cert.PrivateKeyExists))
                            {
                        _ftpServer.CertStorage.Add(cert, true);                                
                            }                            
                        }
                        catch (Exception ex)
                        {
                            _loggingService.Error("FTPs: " + ex.Message, ex.Source, ex);
                        }
                    }
                }

Thank You
Martin
#32581
Posted: 03/11/2015 03:36:47
by ITSG (Standard support level)
Joined: 06/27/2013
Posts: 34

BTW: I want to do it from one single PFX, because in our Software we can only specify one PFX as source...
#32582
Posted: 03/11/2015 03:40:14
by Ken Ivanov (EldoS Corp.)

Hi Martin,

Thank you for getting in touch with us.

Yes, you can load several certificates from one PFX file into a certificate storage. Please see the TElMemoryCertStorage.LoadFromStreamPFX() method.

Ken

Reply

Statistics

Topic viewed 298 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!