コード例 #1
0
        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);
        }
コード例 #2
0
 /// <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);
 }