private async Task <Tuple <string, string> > GetRSAKeys() { Tuple <string, string> keys; if (await RSAKeysExists(_deviceId)) { keys = await GetRSAKeysFromStorage(_deviceId); } else { keys = await _cryptoService.GenerateRSAKeyPairAsync(); await _keyStorageContainer.WritePublicKeyAsync(_deviceId, keys.Item1); await _keyStorageContainer.WritePrivateKeyAsync(_deviceId, keys.Item2); } return(keys); }
/// <summary> /// Saves a public key for the given id /// </summary> /// <param name="id">The key owner id</param> /// <param name="key">The key to be saved</param> /// <returns>The key as string</returns> public async Task SaveClientRSAKeyAsync(string id, string key) { await _keyStorageContainer.WritePublicKeyAsync(id, key); }