private CryptographicKey GetReferencedKey()

in src/Azure.WebSites.DataProtection/AzureWebsitesXmlRepository.cs [111:129]


        private CryptographicKey GetReferencedKey(string reference)
        {
            try
            {
                Guid keyId;
                if (Guid.TryParse(Environment.GetEnvironmentVariable(reference), out keyId))
                {
                    string value = Environment.GetEnvironmentVariable(GetKeySettingName(keyId));

                    if (!string.IsNullOrEmpty(value))
                    {
                        return new CryptographicKey(keyId, ConvertHexToByteArray(value));
                    }
                }
            }
            catch { }

            return null;
        }