public NegotiateContextToken(GssApiToken gssToken)
        {
            // SPNego tokens optimistically include a token of the first MechType
            // so if mechType[0] == Ntlm process as ntlm, == kerb process as kerb, etc.

            token = NegotiationToken.Decode(gssToken.Token);
        }
示例#2
0
        public NegotiateContextToken(GssApiToken gssToken)
        {
            if (gssToken == null)
            {
                throw new ArgumentNullException(nameof(gssToken));
            }

            // SPNego tokens optimistically include a token of the first MechType
            // so if mechType[0] == Ntlm process as ntlm, == kerb process as kerb, etc.

            this.Token = NegotiationToken.Decode(gssToken.Token);
        }
示例#3
0
        public ReadOnlyMemory <byte> EncodeNegotiate()
        {
            var negoToken = new NegotiationToken
            {
                InitialToken = new NegTokenInit
                {
                    MechTypes = new[] { SPNegoOid },
                    MechToken = EncodeApplication()
                }
            };

            return(negoToken.Encode().AsMemory());
        }
示例#4
0
        public ReadOnlyMemory <byte> EncodeGssApi()
        {
            var token = GssApiToken.Encode(Kerberos5Oid, this);

            var negoToken = new NegotiationToken
            {
                InitialToken = new NegTokenInit
                {
                    MechTypes = new[] { Kerberos5Oid },
                    MechToken = token
                }
            };

            return(GssApiToken.Encode(SPNegoOid, negoToken));
        }
示例#5
0
        public static ReadOnlyMemory <byte> Encode(Oid oid, NegotiationToken token)
        {
            using (var writer = new AsnWriter(AsnEncodingRules.DER))
            {
                writer.PushSequence(ApplicationTag);

                writer.WriteObjectIdentifier(oid);

                writer.WriteEncodedValue(token.Encode());

                writer.PopSequence(ApplicationTag);

                return(writer.Encode());
            }
        }
示例#6
0
        public static ReadOnlyMemory <byte> Encode(Oid oid, NegotiationToken token)
        {
            if (token == null)
            {
                throw new ArgumentNullException(nameof(token));
            }

            using (var writer = new AsnWriter(AsnEncodingRules.DER))
            {
                writer.PushSequence(ApplicationTag);

                writer.WriteObjectIdentifier(oid);

                writer.WriteEncodedValue(token.Encode().Span);

                writer.PopSequence(ApplicationTag);

                return(writer.Encode());
            }
        }