public ConnectionManager(ILogger logger, ICredentialProvider credentialProvider, INetworkConnection networkConnectivity, IServerLocator serverDiscovery, string applicationName, string applicationVersion, IDevice device, ClientCapabilities clientCapabilities, ICryptographyProvider cryptographyProvider, Func <IClientWebSocket> webSocketFactory = null, ILocalAssetManager localAssetManager = null) { _credentialProvider = credentialProvider; _networkConnectivity = networkConnectivity; _logger = logger; _serverDiscovery = serverDiscovery; _httpClient = AsyncHttpClientFactory.Create(logger); ClientCapabilities = clientCapabilities; _webSocketFactory = webSocketFactory; _cryptographyProvider = cryptographyProvider; _localAssetManager = localAssetManager; Device = device; ApplicationVersion = applicationVersion; ApplicationName = applicationName; ApiClients = new Dictionary <string, IApiClient>(StringComparer.OrdinalIgnoreCase); SaveLocalCredentials = true; Device.ResumeFromSleep += Device_ResumeFromSleep; var jsonSerializer = new NewtonsoftJsonSerializer(); _connectService = new ConnectService(jsonSerializer, _logger, _httpClient, _cryptographyProvider, applicationName, applicationVersion); }
public void Setup() { _rootNodeSerializer = new XmlRootNodeSerializer(); _cryptographyProvider = new AeadCryptographyProvider(); _rootNodeInfo = new RootNodeInfo(RootNodeType.Connection); _version = new Version(99, 1); }
public XmlConnectionsDecryptor(BlockCipherEngines blockCipherEngine, BlockCipherModes blockCipherMode, RootNodeInfo rootNodeInfo) { _cryptographyProvider = new CryptoProviderFactory(blockCipherEngine, blockCipherMode).Build(); _rootNodeInfo = rootNodeInfo; }
public void Setup() { _cryptographyProvider = new AeadCryptographyProvider { KeyDerivationIterations = 10000 }; _cipherText = "MPELiwk7+xeNlruIyt5uxTvVB+/RLVoLdUGnwY4CWCqwKe7T2IBwWo4oaKum5hdv7447g5m2nZsYPrfARSlotQB4r1KZQg=="; }
public Log AddMac(ICryptographyProvider cryptographyProvider) { var bytes = Encoding.UTF8.GetBytes(this.logText); this.mac = cryptographyProvider.Hmac(bytes).ByteArrayToBase64(); return(this); }
public ConnectionManager(ILogger logger, ICredentialProvider credentialProvider, INetworkConnection networkConnectivity, IServerLocator serverDiscovery, string applicationName, string applicationVersion, IDevice device, ClientCapabilities clientCapabilities, ICryptographyProvider cryptographyProvider, Func<IClientWebSocket> webSocketFactory = null, ILocalAssetManager localAssetManager = null) { _credentialProvider = credentialProvider; _networkConnectivity = networkConnectivity; _logger = logger; _serverDiscovery = serverDiscovery; _httpClient = AsyncHttpClientFactory.Create(logger); ClientCapabilities = clientCapabilities; _webSocketFactory = webSocketFactory; _cryptographyProvider = cryptographyProvider; _localAssetManager = localAssetManager; Device = device; ApplicationVersion = applicationVersion; ApplicationName = applicationName; ApiClients = new Dictionary<string, IApiClient>(StringComparer.OrdinalIgnoreCase); SaveLocalCredentials = true; Device.ResumeFromSleep += Device_ResumeFromSleep; var jsonSerializer = new NewtonsoftJsonSerializer(); _connectService = new ConnectService(jsonSerializer, _logger, _httpClient, _cryptographyProvider, applicationName, applicationVersion); }
public EmbyClient(IAppLogger logger, IDevice device, ICryptographyProvider cryptographyProvider, IConnectionInformation connectionInformation, IApplicationInformation applicationInformation) : base(logger, connectionInformation.ServerUrl, applicationInformation.Name, device, applicationInformation.Version, cryptographyProvider) { _connectionInformation = connectionInformation; }
public User AddMac(ICryptographyProvider cryptographyProvider) { var bytes = Encoding.UTF8.GetBytes(this.ToStringNoMac()); this.Hmac = cryptographyProvider.Hmac(bytes).ByteArrayToBase64(); return(this); }
public string Serialize(ConnectionInfo serializationTarget) { var factory = new CryptographyProviderFactory(); _cryptographyProvider = factory.CreateAeadCryptographyProvider(mRemoteNG.Settings.Default.EncryptionEngine, mRemoteNG.Settings.Default.EncryptionBlockCipherMode); return(SerializeConnectionsData(serializationTarget)); }
public void Create(JsonWebKey jwk, Type clientType) { ICryptographyProvider provider = LocalCryptographyProviderFactory.Create(new KeyVaultKey { Key = jwk }); Assert.IsInstanceOf(clientType, provider, "Key {0} of type {1} did not yield client type {2}", jwk.Id, jwk.KeyType, clientType.Name); }
public void NoKeyMaterial() { KeyVaultKey key = new KeyVaultKey(); ICryptographyProvider provider = LocalCryptographyProviderFactory.Create(key); Assert.IsNull(provider); }
public async Task <LoggingLogin> AddMac(ICryptographyProvider cryptographyProvider) { var bytes = Encoding.UTF8.GetBytes(this.ToStringNoMac()); var hmac = cryptographyProvider.Hmac(bytes); this.Hmac = Convert.ToBase64String(hmac); return(this); }
public void Setup() { _cryptographyProvider = new CryptographyProviderFactory().CreateAeadCryptographyProvider(BlockCipherEngines.AES, BlockCipherModes.GCM); var saveFilter = new SaveFilter(); _documentCompiler = new XmlConnectionsDocumentCompiler(_cryptographyProvider, saveFilter); _connectionTreeModel = SetupConnectionTreeModel(); }
public DataTableSerializer(SaveFilter saveFilter, ICryptographyProvider cryptographyProvider, SecureString encryptionKey) { _saveFilter = saveFilter.ThrowIfNull(nameof(saveFilter)); _cryptographyProvider = cryptographyProvider.ThrowIfNull(nameof(cryptographyProvider)); _encryptionKey = encryptionKey.ThrowIfNull(nameof(encryptionKey)); }
public PasswordAuthenticator(ICryptographyProvider cryptographyProvider, string cipherText, Func <Optional <SecureString> > authenticationRequestor) { _cryptographyProvider = cryptographyProvider.ThrowIfNull(nameof(cryptographyProvider)); _cipherText = cipherText.ThrowIfNullOrEmpty(nameof(cipherText)); _authenticationRequestor = authenticationRequestor.ThrowIfNull(nameof(authenticationRequestor)); }
public Elector(ICryptographyProvider cryptographyProvider, Dictionary <string, object> initialData, Dictionary <string, object> validatorPublicKey) { _cryptographyProvider = cryptographyProvider; _privateKey = initialData.GetDictionary("private_key"); _publicEncryptionKey = initialData.GetDictionary("public_encrypt_key"); _publicSignKey = initialData.GetDictionary("public_sign_key"); _blindKey = initialData.GetDictionary("blind_key"); _validatorPublicKey = validatorPublicKey; }
public ConnectService(IJsonSerializer jsonSerializer, ILogger logger, IAsyncHttpClient httpClient, ICryptographyProvider cryptographyProvider, string appName, string appVersion) { JsonSerializer = jsonSerializer; _logger = logger; _httpClient = httpClient; _cryptographyProvider = cryptographyProvider; _appName = appName; _appVersion = appVersion; }
private XAttribute CreateProtectedAttribute(RootNodeInfo rootNodeInfo, ICryptographyProvider cryptographyProvider) { var attribute = new XAttribute(XName.Get("Protected"), ""); var plainText = rootNodeInfo.Password ? "ThisIsProtected" : "ThisIsNotProtected"; var encryptionPassword = rootNodeInfo.PasswordString.ConvertToSecureString(); attribute.Value = cryptographyProvider.Encrypt(plainText, encryptionPassword); return(attribute); }
public Agency(ICryptographyProvider cryptographyProvider, Dictionary <string, object> validatorPublicKey, int electorsCount) { _cryptographyProvider = cryptographyProvider; _validatorPublicKey = validatorPublicKey; _electorsCount = electorsCount; _random = new Random(); _usedIds = new List <int>(); _encryptedBulletins = new Dictionary <int, byte[]>(); }
public LoginPageModel( IAuthenticationService authenticationService, Service.IAuthorizationService authorizationService, ICryptographyProvider cryptographyProvider) { _authenticationService = authenticationService; _authorizationService = authorizationService; _cryptographyProvider = cryptographyProvider; _loginControlName = typeof(LoginControl).Name.ToString(); }
private XAttribute CreateProtectedAttribute(RootNodeInfo rootNodeInfo, ICryptographyProvider cryptographyProvider, bool export) { var attribute = new XAttribute(XName.Get("Protected"), ""); var plainText = rootNodeInfo.Password && !export ? "ThisIsProtected" : "ThisIsNotProtected"; var encryptionPassword = export ? rootNodeInfo.DefaultPassword.ConvertToSecureString() : rootNodeInfo.PasswordString.ConvertToSecureString(); attribute.Value = cryptographyProvider.Encrypt(plainText, encryptionPassword); return attribute; }
public EncryptionProvider(ILogger <EncryptionProvider> logger, IMapperProvider mapperProvider, ISwitch <string, ICryptographicCredentials> cryptographicCredentialsSwitch, ICryptographyProvider cryptographyProvider, IHashingProvider hashingProvider) { _logger = logger; _mapperProvider = mapperProvider; _cryptographicCredentialsSwitch = cryptographicCredentialsSwitch; _cryptographyProvider = cryptographyProvider; _hashingProvider = hashingProvider; }
private void DecryptAuthHeader(XElement rootElement, ICryptographyProvider cryptographyProvider, SecureString key) { var authAttribute = rootElement.Attribute("Auth"); if (authAttribute == null) { throw new EncryptionException("Could not find Auth header in the XML repository root element."); } cryptographyProvider.Decrypt(authAttribute.Value, key); }
public LocalAssetManager(IUserActionRepository userActionRepository, IItemRepository itemRepository, IFileRepository fileRepository, ICryptographyProvider cryptographyProvider, ILogger logger, IUserRepository userRepository, IImageRepository iImageRepository) { _userActionRepository = userActionRepository; _itemRepository = itemRepository; _fileRepository = fileRepository; _cryptographyProvider = cryptographyProvider; _logger = logger; _userRepository = userRepository; _imageRepository = iImageRepository; }
public MessagePayloadEncryptionPlugin(ICryptographyProvider cryptographyProvider, string intCheckKeyPropertyName = "int-check-key", string intCheckStatusPropertyName = "int-check-status", bool throwExceptionWhenMissingProperties = false) { this.cryptographyProvider = cryptographyProvider; this.intCheckKeyPropertyName = intCheckKeyPropertyName; this.intCheckStatusPropertyName = intCheckStatusPropertyName; this.throwExceptionWhenMissingProperties = throwExceptionWhenMissingProperties; }
public void Setup() { _connectionTreeModel = SetupConnectionTreeModel(); _cryptographyProvider = new AeadCryptographyProvider(); var connectionNodeSerializer = new XmlConnectionNodeSerializer27( _cryptographyProvider, _connectionTreeModel.RootNodes.OfType <RootNodeInfo>().First().PasswordString.ConvertToSecureString(), new SaveFilter()); _serializer = new XmlConnectionsSerializer(_cryptographyProvider, connectionNodeSerializer); }
public void NoOctKeyMaterial() { JsonWebKey jwk = new(new[] { KeyOperation.WrapKey, KeyOperation.UnwrapKey }) { KeyType = KeyType.OctHsm, }; ICryptographyProvider provider = LocalCryptographyProviderFactory.Create(jwk, null); Assert.IsNull(provider); }
public void Setup() { _connectionTreeModel = SetupConnectionTreeModel(); _cryptographyProvider = new CryptoProviderFactory(BlockCipherEngines.AES, BlockCipherModes.GCM).Build(); var connectionNodeSerializer = new XmlConnectionNodeSerializer27( _cryptographyProvider, _connectionTreeModel.RootNodes.OfType <RootNodeInfo>().First().PasswordString.ConvertToSecureString(), new SaveFilter()); _documentCompiler = new XmlConnectionsDocumentCompiler(_cryptographyProvider, connectionNodeSerializer); }
private ICredentialRecord BuildCredential(XElement element, ICryptographyProvider cryptographyProvider, SecureString decryptionKey) { var credential = new CredentialRecord { Title = $"{element.Attribute("Username")?.Value}\\{element.Attribute("Domain")?.Value}", Username = element.Attribute("Username")?.Value, Domain = element.Attribute("Domain")?.Value, Password = cryptographyProvider.Decrypt(element.Attribute("Password")?.Value, decryptionKey).ConvertToSecureString() }; return(credential); }
public NoteContentService(DataContext dataContext, JiebaSegmenterService jiebaSegmenter, ConfigFileService configFileService, ICryptographyProvider cryptographyProvider, IDistributedIdGenerator idGenerator) { this.cryptographyProvider = cryptographyProvider; this.idGenerator = idGenerator; this.dataContext = dataContext; this.config = configFileService.WebConfig; this.jieba = jiebaSegmenter; }
public static string GetConnectPasswordMd5(string password, ICryptographyProvider cryptographyProvider) { password = ConnectPassword.PerformPreHashFilter(password ?? string.Empty); var bytes = Encoding.UTF8.GetBytes(password); bytes = cryptographyProvider.CreateMD5(bytes); var hash = BitConverter.ToString(bytes, 0, bytes.Length).Replace("-", string.Empty); return(hash); }
public XElement SerializeRootNodeInfo(RootNodeInfo rootNodeInfo, ICryptographyProvider cryptographyProvider, bool fullFileEncryption = false, bool export = false) { var element = new XElement("Connections"); element.Add(new XAttribute(XName.Get("Name"), rootNodeInfo.Name)); element.Add(new XAttribute(XName.Get("Export"), export.ToString())); element.Add(new XAttribute(XName.Get("EncryptionEngine"), cryptographyProvider.CipherEngine)); element.Add(new XAttribute(XName.Get("BlockCipherMode"), cryptographyProvider.CipherMode)); element.Add(new XAttribute(XName.Get("KdfIterations"), cryptographyProvider.KeyDerivationIterations)); element.Add(new XAttribute(XName.Get("FullFileEncryption"), fullFileEncryption.ToString())); element.Add(CreateProtectedAttribute(rootNodeInfo, cryptographyProvider, export)); element.Add(new XAttribute(XName.Get("ConfVersion"), "2.6")); return element; }
public XmlConnectionsDecryptor(BlockCipherEngines blockCipherEngine, BlockCipherModes blockCipherMode, RootNodeInfo rootNodeInfo) { _cryptographyProvider = new CryptographyProviderFactory().CreateAeadCryptographyProvider(blockCipherEngine, blockCipherMode); _rootNodeInfo = rootNodeInfo; }
public XmlConnectionsDecryptor(RootNodeInfo rootNodeInfo) { _cryptographyProvider = new LegacyRijndaelCryptographyProvider(); _rootNodeInfo = rootNodeInfo; }
public void TearDown() { _cryptographyProvider = null; }
public void Setup() { _cryptographyProvider = new AeadCryptographyProvider(); _encryptionKey = "mypassword111111".ConvertToSecureString(); _plainText = "MySecret!"; }
public XmlConnectionNodeSerializer(ICryptographyProvider cryptographyProvider, SecureString encryptionKey, SaveFilter saveFilter) { _cryptographyProvider = cryptographyProvider; _encryptionKey = encryptionKey; _saveFilter = saveFilter; }
public void Setup() { _rootNodeSerializer = new XmlRootNodeSerializer(); _cryptographyProvider = new AeadCryptographyProvider(); _rootNodeInfo = new RootNodeInfo(RootNodeType.Connection); }
public XmlConnectionNodeSerializer(ICryptographyProvider cryptographyProvider, SecureString encryptionKey) { _cryptographyProvider = cryptographyProvider; _encryptionKey = encryptionKey; }
public void Setup() { _cryptographyProvider = new CryptographyProviderFactory().CreateAeadCryptographyProvider(BlockCipherEngines.AES, BlockCipherModes.GCM); _documentCompiler = new XmlConnectionsDocumentCompiler(_cryptographyProvider); _connectionTreeModel = SetupConnectionTreeModel(); }
public XmlConnectionsDocumentCompiler(ICryptographyProvider cryptographyProvider) { _cryptographyProvider = cryptographyProvider; }
public EncryptedSecureString() { _secureString = new SecureString(); _cryptographyProvider = new AeadCryptographyProvider(); }
public EncryptedSecureString(ICryptographyProvider cryptographyProvider) { _secureString = new SecureString(); _cryptographyProvider = cryptographyProvider; }