private SPNEGONegTokenResp Decode(byte[] data) { SPNEGONegTokenResp spnegoNegTokenResp = new SPNEGONegTokenResp { NegState = ASN1.GetTagBytes(1, data)[0], SupportedMech = ASN1.GetTagBytes(6, data), ResponseToken = ASN1.GetTagBytes(4, data) }; return(spnegoNegTokenResp); }
public NTLMChallenge(byte[] data, bool decode) { if (decode) { SPNEGONegTokenResp token = this.Decode(data); ReadBytes(token.ResponseToken, 0); } else { ReadBytes(data, 0); } }
public NTLMChallenge(byte[] data) { string signature = Encoding.UTF8.GetString(data); if (signature.StartsWith("NTLMSSP")) { ReadBytes(data, 0); } else { SPNEGONegTokenResp token = this.Decode(data); this.ReadBytes(token.ResponseToken, 0); } }
public NTLMResponse(byte[] data, bool decode) { if (decode) { SPNEGONegTokenResp token = this.Decode(data); this.ReadBytes(token.ResponseToken); } else { ReadBytes(data); } ParseValues(); }
public byte[] Encode(byte[] data) { SPNEGONegTokenResp spnegoNegTokenResp = new SPNEGONegTokenResp(); spnegoNegTokenResp.NegState = 1; spnegoNegTokenResp.SupportedMech = new byte[10] { 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x02, 0x0a }; byte[] segment1 = ASN1.Encode(0x04, data); segment1 = ASN1.Encode(0xa2, segment1); byte[] segment2 = ASN1.Encode(0x06, spnegoNegTokenResp.SupportedMech); segment2 = ASN1.Encode(0xa1, segment2); byte[] segment3 = ASN1.Encode(0x0a, new byte[1] { spnegoNegTokenResp.NegState }); segment3 = ASN1.Encode(0xa0, segment3); byte[] asn1Data = Utilities.BlockCopy(segment3, segment2, segment1); asn1Data = ASN1.Encode(0x30, asn1Data); asn1Data = ASN1.Encode(0xa1, asn1Data); return(asn1Data); }