Ejemplo n.º 1
0
        private static string ExtractPolicyText(string jwt)
        {
            string parsedPolicy = string.Empty;

            if (!string.IsNullOrEmpty(jwt))
            {
                try
                {
                    parsedPolicy = JoseHelper.ExtractJosePartField(jwt, 1, "AttestationPolicy").ToString();

                    // Policy is optionally double base64 URL encoded.  We will attempt
                    // to base64 URL decode a second time -- if this throws an exception,
                    // that's OK -- we should just use value as it stands now.
                    var doubleDecodedPolicy = Base64Url.DecodeString(parsedPolicy);
                    parsedPolicy = doubleDecodedPolicy;
                }
                catch (Exception)
                {
                    // Ignore on purpose
                }
            }

            return(parsedPolicy);
        }