public IList <EntriesDecrypterResult <AesKey> > Run(DecryptEntryWorkflowOptions options)
 {
     if (!IsBuilt)
     {
         throw new EnvCryptException("workflow cannot be run because it has not been built");
     }
     return(_workflow.Run(options));
 }
Exemple #2
0
        public IList <EntriesDecrypterResult <AesKey> > Run(DecryptEntryWorkflowOptions options)
        {
            Contract.Requires <ArgumentNullException>(options != null, "options");
            Contract.Requires <ArgumentException>(!string.IsNullOrWhiteSpace(options.DatFilePath), "DAT file path cannot be null or whitespace");
            Contract.Requires <ArgumentException>(Contract.ForAll(options.CategoryEntryPair, t => !string.IsNullOrWhiteSpace(t.Category)),
                                                  "none of the category names can be null or whitespace");
            Contract.Requires <ArgumentException>(Contract.ForAll(options.CategoryEntryPair, t => !string.IsNullOrWhiteSpace(t.Entry)),
                                                  "none of the entry names can be null or whitespace");
            Contract.Requires <ArgumentException>(Contract.ForAll(options.KeyFilePaths, s => !string.IsNullOrWhiteSpace(s)),
                                                  "key file path cannot be null or whitespace");

            return(default(IList <EntriesDecrypterResult <AesKey> >));
        }
Exemple #3
0
        private void DecryptRsa(DecryptGenericWorkflowOptions options, List <PairWithEncyptionAlgo> detailsOfAlgoUsedTakenFromDat, List <EntriesDecrypterResult> ret)
        {
            var rsaRequests =
                detailsOfAlgoUsedTakenFromDat.Where(d => d.EncryptionAlgo == EnvCryptAlgoEnum.Rsa).ToArray();

            if (rsaRequests.Any())
            {
                // Case: RSA
                var workflowOptions = new DecryptEntryWorkflowOptions()
                {
                    CategoryEntryPair            = rsaRequests.Select(r => r.Pair).ToList(),
                    DatFilePath                  = options.DatFilePath,
                    KeyFilePaths                 = new[] { options.KeyFilePath },
                    ThrowIfDecryptingKeyNotFound = false
                };
                var result = _rsaWorkFlowBuilder.WithDatLoader(_datLoader)
                             .Build()
                             .Run(workflowOptions);
                ret.AddRange(result);
            }
        }