示例#1
0
        public JoseHeader(JsonWebAlgorithm alg = 0, JsonWebAlgorithm enc = 0, string kid = null)
        {
            if (dictionary == null)
                dictionary = new OrderedDictionary();

            if (alg > 0)
                SetHeader(JoseHeaderSpec.ALG, EnumString.GetValue(alg));

            if (enc > 0)
                SetHeader(JoseHeaderSpec.ENC, EnumString.GetValue(enc));

            if (!String.IsNullOrEmpty(kid))
                SetHeader(JoseHeaderSpec.KID, kid);
        }
示例#2
0
        public static string GetValue(JsonWebAlgorithm value)
        {
            string output = null;

            Type type = value.GetType();
            FieldInfo fi = type.GetField(value.ToString());
            Description[] attrs = fi.GetCustomAttributes(typeof(Description), false) as Description[];

            if (attrs.Length > 0)
            {
                output = attrs[0].Value;
            }

            return output;
        }