protected override List <TKey> LoadKeys(TWorkflowOptions workflowOptions) { return(new List <TKey>() { _keyLoader.Load(new NullKeyLoaderDetails()) }); }
protected override List <TKey> LoadKeys(TWorkflowOptions workflowOptions) { var keys = new List <TKey>(workflowOptions.KeyFilePaths.Count); for (uint keyPathI = 0; keyPathI < workflowOptions.KeyFilePaths.Count; keyPathI++) { var loadedKey = _keyLoader.Load( new KeyFromFileDetails() { FilePath = workflowOptions.KeyFilePaths[(int)keyPathI] }); keys.Add(loadedKey); } return(keys); }
public IList <byte[]> GetEncryptedSegments(TKeyLoadDetails usingKeyDetails, string toEncrypt, out TKey withKey) { Contract.Requires <ArgumentException>(!string.IsNullOrWhiteSpace(toEncrypt), "toEncrypt"); Contract.Ensures(Contract.ValueAtReturn(out withKey) != null); // var key = _keyLoader.Load(usingKeyDetails); if (!_keySuitabilityChecker.IsEncryptingKey(key)) { throw new EnvCryptException("impossible to encrypt using this {0} key. Name: {1}", key.Algorithm, key.Name); } var binaryToEncrypt = _userStringConverter.Encode(toEncrypt); withKey = key; return(_segmentEncrypter.Encrypt(binaryToEncrypt, key)); }