private static void UpdateCryptoKeyInCache(string cacheKey, SecureString cryptoKey)
 {
     if (cryptoKey != null)
     {
         LocalCryptoKeyStore.Update(cacheKey, cryptoKey);
     }
 }
        private async Task <SecureString> GetKeyFromStoreAsync(string application, string tenantId, string keyIdentifier, string cacheKey)
        {
            var cryptoKey = await _remoteKeyStore.GetCryptoKeyAsync(application, tenantId, keyIdentifier);

            if (cryptoKey != null)
            {
                LocalCryptoKeyStore.Update(cacheKey, cryptoKey);
            }
            return(cryptoKey);
        }
        private SecureString GenerateKeyFromStore(string application, string tenantId, string keyIdentifier, string cacheKey)
        {
            var cryptoKey = _remoteKeyStore.GenerateCryptoKey(application, tenantId, keyIdentifier);

            if (cryptoKey != null)
            {
                LocalCryptoKeyStore.Update(cacheKey, cryptoKey);
            }
            return(cryptoKey);
        }
 private static SecureString GetCryptoKeyFromCache(string cacheKey)
 {
     return(LocalCryptoKeyStore.Get(cacheKey));
 }