public AesDataProtector(IAesProvider aesProvider, ISha256Provider sha256Provider, string key, string primaryPurpose, string[] specificPurposes) { _aesProvider = aesProvider; _sha256Provider = sha256Provider; _appKey = key; using (var sha = _sha256Provider.Create()) { using (var writer = new BinaryWriter(new CryptoStream(new MemoryStream(), sha, CryptoStreamMode.Write), new UTF8Encoding(false, true))) { writer.Write(key); writer.Write(primaryPurpose); if (specificPurposes != null) { foreach (var purpose in specificPurposes) { writer.Write(purpose); } } } _keyMaterial = sha.Hash; } }
internal AesDataProtectionProvider(IAesProvider aesProvider, ISha256Provider sha256Provider, string appKey) { _aesProvider = aesProvider; _sha256Provider = sha256Provider; _appKey = appKey; }