/// <summary> /// 初始化SSL环境 /// </summary> /// <param name="memory">是否通过内存加载证书</param> /// <returns></returns> public virtual bool Initialize(bool memory = false) { if (pServer != IntPtr.Zero) { PemCertFile = string.IsNullOrWhiteSpace(PemCertFile) ? null : PemCertFile; PemKeyFile = string.IsNullOrWhiteSpace(PemKeyFile) ? null : PemKeyFile; KeyPassword = string.IsNullOrWhiteSpace(KeyPassword) ? null : KeyPassword; CAPemCertFileOrPath = string.IsNullOrWhiteSpace(CAPemCertFileOrPath) ? null : CAPemCertFileOrPath; return(memory ? SSLSdk.HP_SSLServer_SetupSSLContextByMemory(pServer, VerifyMode, PemCertFile, PemKeyFile, KeyPassword, CAPemCertFileOrPath, SNIServerNameCallback) : SSLSdk.HP_SSLServer_SetupSSLContext(pServer, VerifyMode, PemCertFile, PemKeyFile, KeyPassword, CAPemCertFileOrPath, SNIServerNameCallback)); } return(false); }