Пример #1
0
 internal void ImportCTL(CTLContext context)
 {
     if (context.CTLInfo.ListIdentifier == null)
     {
         CTLError = "The ListIdentifier of the CTL should be an unicode string to work correctly with http.sys";
         return;
     }
     CTLError           = null;
     CTLIdentifierProxy = context.CTLInfo.ListIdentifier;
     context.ImportInStore(StoreLocation.LocalMachine, CTLStoreNameProxy.store.Value);
     OnPropertyChanged(() => this.HasValidCTL);
 }
Пример #2
0
        public void CanCreateSerializeAndReloadCTLContext()
        {
            var ctlBuilder = new CTLContextBuilder();

            ctlBuilder.CTLInfo.Certificates.Add(TestCertificate);
            ctlBuilder.CTLInfo.ListIdentifier = "test list";
            var ctlContext = ctlBuilder.ToCTLContext();

            Assert.Equal("test list", ctlContext.FriendlyName);
            var bytes            = ctlContext.ToBytes();
            var loadedCtlContext = CTLContext.Load(bytes);

            Assert.Equal("test list", loadedCtlContext.FriendlyName);
            AssertCollectionEquals(TestCertificate.GetCertHash(), loadedCtlContext.CTLInfo.Entries[0].SubjectIdentifier);
        }
Пример #3
0
        private void Import_CTL(object sender, RoutedEventArgs e)
        {
            if (ViewModel.CTLStoreNameProxy.store == null)
            {
                return;
            }
            OpenFileDialog fileDialog = new OpenFileDialog();

            fileDialog.Filter          = "STL files (*.stl)|*.stl";
            fileDialog.CheckFileExists = true;
            fileDialog.CheckPathExists = true;
            var result = fileDialog.ShowDialog();

            if (result.HasValue && result.Value)
            {
                var context = CTLContext.Load(File.ReadAllBytes(fileDialog.FileName));
                ViewModel.ImportCTL(context);
            }
        }
Пример #4
0
        public void CanImportLoadThenDeleteCTLInStore()
        {
            var ctlBuilder = new CTLContextBuilder();

            ctlBuilder.CTLInfo.Certificates.Add(TestCertificate);
            ctlBuilder.CTLInfo.ListIdentifier = "test list import";
            var ctlContext = ctlBuilder.ToCTLContext();

            ctlContext.ImportInStore(StoreLocation.CurrentUser, StoreName.My);
            try
            {
                Assert.NotNull(CTLContext.Get(StoreLocation.CurrentUser, StoreName.My, "test list import"));
                ctlContext.RemoveFromStore(StoreLocation.CurrentUser, StoreName.My);
                Assert.Null(CTLContext.Get(StoreLocation.CurrentUser, StoreName.My, "test list import"));
                ctlContext.RemoveFromStore(StoreLocation.CurrentUser, StoreName.My);                 //Does not throw if does not exist
            }
            finally
            {
                ctlContext.RemoveFromStore(StoreLocation.CurrentUser, StoreName.My);
            }
        }
Пример #5
0
        public void CanReadExistingCTL()
        {
            var ctl = CTLContext.Load(AuthRootCTL);

            Assert.NotNull(ctl);
        }