示例#1
0
        public void Run(RemoveEntryVerbOptions options)
        {
            var categories = options.GetCategories();
            var entries    = options.GetEntries();

            if (categories.Count != entries.Count)
            {
                throw new EnvCryptConsoleException("count of categories and entries do not match");
            }

            var categoryEntryPairs = new List <CategoryEntryPair>();

            for (uint catI = 0; catI < categories.Count; catI++)
            {
                var toAdd = new CategoryEntryPair(categories[(int)catI], entries[(int)catI]);
                categoryEntryPairs.Add(toAdd);
            }


            var builder = new RemoveEntryWorkflowBuilder();

            builder.Build().Run(
                new DatFromFileLoaderOptions()
            {
                DatFilePath = options.DatFile,
            },
                categoryEntryPairs,
                new DatToFileSaverOptions()
            {
                DestinationFilePath = options.DatFile
            });
        }
        public void Run(DecryptEntryVerbOptions options)
        {
            var categories = options.GetCategories();
            var entries    = options.GetEntries();

            if (categories.Count != entries.Count)
            {
                throw new EnvCryptConsoleException("count of categories and entries do not match");
            }

            var categoryEntryPairs = new List <CategoryEntryPair>();

            for (uint catI = 0; catI < categories.Count; catI++)
            {
                var toAdd = new CategoryEntryPair(categories[(int)catI], entries[(int)catI]);
                categoryEntryPairs.Add(toAdd);
            }


            var builder = new DecryptGenericWorkflowBuilder(
                new DecryptPlainTextEntryWorkflowBuilder(),
                new DecryptRsaEntryWorkflowBuilder(),
                new DecryptAesEntryWorkflowBuilder());
            var result = builder.Build().Run(new DecryptGenericWorkflowOptions()
            {
                CategoryEntryPair             = categoryEntryPairs,
                DatFilePath                   = options.DatFile,
                KeyFilePath                   = options.KeyFile,
                ThrowExceptionIfEntryNotFound = true,
            });

            OutputToConsole(result);
        }
示例#3
0
 public PairWithEncyptionAlgo(CategoryEntryPair pair, EnvCryptAlgoEnum encryptionAlgo)
 {
     Pair           = pair;
     EncryptionAlgo = encryptionAlgo;
 }