SIPSorcery.SIP.SIPTransportConfig.LoadCertificate C# (CSharp) Method

LoadCertificate() private static method

private static LoadCertificate ( string certificateType, string certifcateLocation, string certKeyPassword ) : X509Certificate2
certificateType string
certifcateLocation string
certKeyPassword string
return System.Security.Cryptography.X509Certificates.X509Certificate2
        private static X509Certificate2 LoadCertificate(string certificateType, string certifcateLocation, string certKeyPassword)
        {
            try
            {

                if (certificateType == "file")
                {
                    X509Certificate2 serverCertificate = new X509Certificate2(certifcateLocation, certKeyPassword);
                    //DisplayCertificateChain(m_serverCertificate);
                    bool verifyCert = serverCertificate.Verify();
                    logger.Debug("Server Certificate loaded from file, Subject=" + serverCertificate.Subject + ", valid=" + verifyCert + ".");
                    return serverCertificate;
                }
                else
                {
                    StoreLocation store = (certificateType == "machinestore") ? StoreLocation.LocalMachine : StoreLocation.CurrentUser;
                    return AppState.LoadCertificate(store, certifcateLocation, true);
                }
            }
            catch (Exception excp)
            {
                logger.Error("Exception LoadCertificate. " + excp.Message);
                return null;
            }
        }