Amazon.SimpleNotificationService.Util.Message.ValidateCertUrl C# (CSharp) Метод

ValidateCertUrl() приватный статический Метод

Verifies that the signing certificate url is from a recognizable source. Returns the cert url if it cen be verified, otherwise throws an exception.
private static ValidateCertUrl ( string certUrl ) : string
certUrl string
Результат string
        private static string ValidateCertUrl(string certUrl)
        {
            var uri = new Uri(certUrl);
            if (uri.Scheme == "https" && certUrl.EndsWith(".pem", StringComparison.Ordinal))
            {
                const string pattern = @"^sns\.[a-zA-Z0-9\-]{3,}\.amazonaws\.com(\.cn)?$";
                var regex = new Regex(pattern);
                if (regex.IsMatch(uri.Host))
                    return certUrl;
            }

            throw new AmazonClientException("Signing certificate url is not from a recognised source.");
        }