RandomAnimalSounds/AlexaRequestAuthenticator.cs
/// <summary>
/// Parses the suject alternative names.
/// </summary>
/// <param name="cert">The cert.</param>
/// <returns></returns>
Parses the suject alternative names.
Parses the suject alternative names .
private static IEnumerable<string> GetSubjectAlternativeNames(this X509Certificate2 cert)
        {
            Regex sanRex = new Regex(@"^DNS Name=(.*)", RegexOptions.Compiled | RegexOptions.CultureInvariant);
            var sanList = from X509Extension ext in cert.Extensions
                          where ext.Oid.FriendlyName.Equals("Subject Alternative Name", StringComparison.Ordinal)
                          let data = new AsnEncodedData(ext.Oid, ext.RawData)
                          let text = data.Format(true)
                          from line in text.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries)
                          let match = sanRex.Match(line)
                          where match.Success && match.Groups.Count > 0 && !string.IsNullOrEmpty(match.Groups[1].Value)
                          select match.Groups[1].Value;
            return sanList;
        }
private static IEnumerable < string > GetSubjectAlternativeNames ( this X509Certificate2 cert ) { Regex sanRex = new Regex ( @"^DNS Name=(.*)" , RegexOptions . Compiled | RegexOptions . CultureInvariant ) ; var sanList = from X509Extension ext in cert . Extensions where ext . Oid . FriendlyName . Equals ( " " , StringComparison . Ordinal ) let data = new AsnEncodedData ( ext . Oid , ext . RawData ) let text = data . Format ( true ) from line in text . Split ( new char [ ] { ' \r ' , ' \n ' } , StringSplitOptions . RemoveEmptyEntries ) let match = sanRex . Match ( line ) where match . Success && match . Groups . Count > 0 && ! string . IsNullOrEmpty ( match . Groups [ 1 ] . Value ) select match . Groups [ 1 ] . Value ; return sanList ; }
Parses the suject alternative names.
Parses the suject alternative names .
None
X509Certificate2
this
cert
None