示例#1
0
        public static AuthorityKeyIdentifierExtension FromExtensionData(byte[] data)
        {
            var seq  = Asn1Sequence.ReadNode(data);
            var node = (Asn1CustomNode)seq.Nodes[0];

            return(new AuthorityKeyIdentifierExtension(node.Data));
        }
示例#2
0
        public AuthorityInfoAccessExtension(byte[] data)
        {
            var seq = Asn1Sequence.ReadNode(data);

            foreach (var node in seq.Nodes)
            {
                var mn  = (Asn1Sequence)node;
                var id  = (Asn1ObjectIdentifier)mn.Nodes[0];
                var cd  = (Asn1CustomNode)mn.Nodes[1];
                var str = Encoding.UTF8.GetString(cd.Data);
                Methods.Add(new AuthorityAccessDescription {
                    Url = str
                });
            }
        }
示例#3
0
        public static BasicConstraintExtension FromExtensionData(byte[] data)
        {
            if (data == null)
            {
                throw new ArgumentNullException(nameof(data));
            }
            var   seq                  = Asn1Sequence.ReadNode(data);
            bool  authority            = false;
            ulong?pathLengthConstraint = null;

            if (seq.Nodes.Count > 0)
            {
                authority = ((Asn1Boolean)seq.Nodes[0]).Value;
                if (seq.Nodes.Count > 1)
                {
                    pathLengthConstraint = ((Asn1Integer)seq.Nodes[1]).ToUInt64();
                }
            }
            return(new BasicConstraintExtension {
                Authority = authority,
                PathLengthConstraint = pathLengthConstraint
            });
        }