示例#1
0
        public CertVault(DirectoryPath baseDir, CertVaultSettings?defaultSettings = null, CertificateStore?defaultCertificate = null, TcpIpSystem?tcpIp = null, bool isGlobalVault = false)
        {
            try
            {
                Util.PutGitIgnoreFileOnDirectory(baseDir, flags: FileFlags.AutoCreateDirectory);

                this.AutoGeneratingRootCA = DevTools.CoresDebugCACert.PkiCertificateStore;

                this.DefaultCertificate = defaultCertificate;

                this.TcpIp = tcpIp ?? LocalNet;

                this.IsGlobalCertVault = isGlobalVault;

                if (defaultSettings == null)
                {
                    defaultSettings = new CertVaultSettings(EnsureSpecial.Yes);
                }

                this.DefaultSettings = (CertVaultSettings)defaultSettings.Clone();

                this.BaseDir = baseDir;

                this.StaticDir = this.BaseDir.GetSubDirectory("StaticCerts");

                this.AcmeDir = this.BaseDir.GetSubDirectory("AcmeCerts");

                this.AutoGeneratedDir = this.BaseDir.GetSubDirectory("AutoGeneratedCerts");

                this.SettingsFilePath = this.BaseDir.Combine(Consts.FileNames.CertVault_Settings);

                this.AcmeAccountKeyFilePath = this.AcmeDir.Combine(Consts.FileNames.CertVault_AcmeAccountKey);
                this.AcmeCertKeyFilePath    = this.AcmeDir.Combine(Consts.FileNames.CertVault_AcmeCertKey);

                this.CertificateSelectorCache        = new SyncCache <string, CertificateStore>(CoresConfig.CertVaultSettings.CertificateSelectorCacheLifetime, CacheFlags.IgnoreUpdateError, hostname => this.SelectBestFitCertificate(hostname, out _, false));
                this.CertificateSelectorCache_NoAcme = new SyncCache <string, CertificateStore>(CoresConfig.CertVaultSettings.CertificateSelectorCacheLifetime, CacheFlags.IgnoreUpdateError, hostname => this.SelectBestFitCertificate(hostname, out _, true));

                Reload();

                this.StartMainLoop(MainLoopAsync);
            }
            catch (Exception ex)
            {
                this._DisposeSafe();
                ex._Debug();
                throw;
            }
        }
示例#2
0
        protected CacheSyncDependency GetCacheSyncDependencyObj(Alachisoft.NCache.Common.Protobuf.SyncDependency protocolSyncDependency)
        {
            if (protocolSyncDependency == null)
            {
                return(null);
            }
            SyncCache syncCache = new SyncCache(protocolSyncDependency.cacheId,
                                                protocolSyncDependency.server,
                                                protocolSyncDependency.port, false);

            CacheSyncDependency syncDep = new CacheSyncDependency(protocolSyncDependency.cacheId,
                                                                  protocolSyncDependency.key,
                                                                  syncCache);

            return(syncDep);
        }