Exemplo n.º 1
0
        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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
        public ReadOnlyMemory <byte> EncodeNegotiate()
        {
            var negoToken = new NegotiationToken
            {
                InitialToken = new NegTokenInit
                {
                    MechTypes = new[] { SPNegoOid },
                    MechToken = EncodeApplication()
                }
            };

            return(negoToken.Encode().AsMemory());
        }
Exemplo n.º 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));
        }
Exemplo n.º 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());
            }
        }
Exemplo n.º 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());
            }
        }