Ejemplo n.º 1
0
        internal static KerberosHostAddress Parse(DERValue value)
        {
            if (!value.CheckSequence())
            {
                throw new InvalidDataException();
            }
            KerberosHostAddressType type = 0;

            byte[] data = null;
            foreach (var next in value.Children)
            {
                if (next.Type != DERTagType.ContextSpecific)
                {
                    throw new InvalidDataException();
                }
                switch (next.Tag)
                {
                case 0:
                    type = (KerberosHostAddressType)next.ReadChildInteger();
                    break;

                case 1:
                    data = next.ReadChildOctetString();
                    break;

                default:
                    throw new InvalidDataException();
                }
            }

            if (type == 0 || data == null)
            {
                throw new InvalidDataException();
            }
            return(new KerberosHostAddress(type, data));
        }
Ejemplo n.º 2
0
 private KerberosHostAddress(KerberosHostAddressType type, byte[] address)
 {
     AddressType = type;
     Address     = address;
 }