using System; using System.Collections.Generic; using System.Threading.Tasks; using Bit.Core.Enums; using Bit.Core.Models.Domain; using Bit.Core.Models.Response; namespace Bit.Core.Abstractions { public interface ICryptoService { Task ClearEncKeyAsync(bool memoryOnly = false); Task ClearKeyAsync(); Task ClearKeyHashAsync(); Task ClearKeyPairAsync(bool memoryOnly = false); Task ClearKeysAsync(); Task ClearOrgKeysAsync(bool memoryOnly = false); Task ClearPinProtectedKeyAsync(); Task DecryptFromBytesAsync(byte[] encBytes, SymmetricCryptoKey key); Task DecryptToBytesAsync(CipherString cipherString, SymmetricCryptoKey key = null); Task DecryptToUtf8Async(CipherString cipherString, SymmetricCryptoKey key = null); Task EncryptAsync(byte[] plainValue, SymmetricCryptoKey key = null); Task EncryptAsync(string plainValue, SymmetricCryptoKey key = null); Task EncryptToBytesAsync(byte[] plainValue, SymmetricCryptoKey key = null); Task GetEncKeyAsync(); Task> GetFingerprintAsync(string userId, byte[] publicKey = null); Task GetKeyAsync(); Task GetKeyHashAsync(); Task GetOrgKeyAsync(string orgId); Task> GetOrgKeysAsync(); Task GetPrivateKeyAsync(); Task GetPublicKeyAsync(); Task HasEncKeyAsync(); Task HashPasswordAsync(string password, SymmetricCryptoKey key); Task HasKeyAsync(); Task> MakeEncKeyAsync(SymmetricCryptoKey key); Task MakeKeyAsync(string password, string salt, KdfType? kdf, int? kdfIterations); Task MakeKeyFromPinAsync(string pin, string salt, KdfType kdf, int kdfIterations); Task> MakeKeyPairAsync(SymmetricCryptoKey key = null); Task MakePinKeyAysnc(string pin, string salt, KdfType kdf, int kdfIterations); Task> MakeShareKeyAsync(); Task RandomNumberAsync(int min, int max); Task> RemakeEncKeyAsync(SymmetricCryptoKey key); Task RsaEncryptAsync(byte[] data, byte[] publicKey = null); Task SetEncKeyAsync(string encKey); Task SetEncPrivateKeyAsync(string encPrivateKey); Task SetKeyAsync(SymmetricCryptoKey key); Task SetKeyHashAsync(string keyHash); Task SetOrgKeysAsync(IEnumerable orgs); Task ToggleKeyAsync(); } }