Exemplo n.º 1
0
        /// <summary>
        /// 初始化SSL环境
        /// </summary>
        /// <param name="callback"></param>
        /// <returns></returns>
        public virtual bool Initialize()
        {
            if (pServer != IntPtr.Zero)
            {
                PemCertFile         = string.IsNullOrWhiteSpace(PemCertFile) ? null : PemCertFile;
                PemKeyFile          = string.IsNullOrWhiteSpace(PemKeyFile) ? null : PemKeyFile;
                KeyPasswod          = string.IsNullOrWhiteSpace(KeyPasswod) ? null : KeyPasswod;
                CAPemCertFileOrPath = string.IsNullOrWhiteSpace(CAPemCertFileOrPath) ? null : CAPemCertFileOrPath;

                return(SSLSdk.HP_SSLServer_SetupSSLContext(pServer, VerifyMode, PemCertFile, PemKeyFile, KeyPasswod, CAPemCertFileOrPath, SNIServerNameCallback));
            }

            return(false);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 初始化SSL环境
        /// </summary>
        /// <param name="callback"></param>
        /// <returns></returns>
        public virtual bool Initialize()
        {
            lock (SSLInitLock)
            {
                //if (SSLSdk.HP_SSL_IsValid() == false)
                {
                    PemCertFile         = string.IsNullOrWhiteSpace(PemCertFile) ? null : PemCertFile;
                    PemKeyFile          = string.IsNullOrWhiteSpace(PemKeyFile) ? null : PemKeyFile;
                    KeyPasswod          = string.IsNullOrWhiteSpace(KeyPasswod) ? null : KeyPasswod;
                    CAPemCertFileOrPath = string.IsNullOrWhiteSpace(CAPemCertFileOrPath) ? null : CAPemCertFileOrPath;

                    return(SSLSdk.HP_SSLServer_SetupSSLContext(pServer, VerifyMode, PemCertFile, PemKeyFile, KeyPasswod, CAPemCertFileOrPath, SNIServerNameCallback));
                }

                //return true;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 初始化SSL环境
        /// </summary>
        /// <returns></returns>
        protected virtual bool Initialize()
        {
            lock (SSLInitLock)
            {
                //if (SSLSdk.HP_SSL_IsValid() == false)
                {
                    PemCertFile         = string.IsNullOrWhiteSpace(PemCertFile) ? null : PemCertFile;
                    PemKeyFile          = string.IsNullOrWhiteSpace(PemKeyFile) ? null : PemKeyFile;
                    KeyPasswod          = string.IsNullOrWhiteSpace(KeyPasswod) ? null : KeyPasswod;
                    CAPemCertFileOrPath = string.IsNullOrWhiteSpace(CAPemCertFileOrPath) ? null : CAPemCertFileOrPath;

                    var ret = SSLSdk.HP_SSLServer_SetupSSLContext(pServer, VerifyMode, PemCertFile, PemKeyFile, KeyPasswod, CAPemCertFileOrPath, SNIServerNameCallback);
                    System.Diagnostics.Trace.WriteLine($"ssl Initialize : {ret}");
                }

                return(true);
            }
        }