static public byte[] FinalHandshake(SSPI.SSPIHelper sspi, byte[] challenge, string userName) { if (challenge.Length == 0) { //S0 return new byte[0]; } else { //S1 //byte[] decryptedChallenge; //sspi.Unwrap(challenge.Length, challenge, out decryptedChallenge); // pure buffer - need SASL parser to preceed byte[] userNameUtf8 = null; if (userName != null && userName.Length > 0) userNameUtf8 = Encoding.UTF8.GetBytes(userName); byte[] rawResponse = new byte[4 + ((userNameUtf8 == null) ? 0 : userNameUtf8.Length)]; rawResponse[0] = 1; // QOP rawResponse[1] = 1; // MAX BUF SIZE rawResponse[2] = 0; // MAX BUF SIZE rawResponse[3] = 0; // MAX BUF SIZE if (userNameUtf8 != null) Buffer.BlockCopy(userNameUtf8, 0, rawResponse, 4, userNameUtf8.Length); byte[] encryptedResponse; sspi.Wrap(rawResponse, out encryptedResponse); return encryptedResponse; } }
public string GetConnectionString() { string conn; conn = string.Format("data source={0}; initial catalog={1}; persist security info=True; user id={2}; password={3}; MultipleActiveResultSets=True; App=EntityFrameworkCore", Server, Database, User, Password); if (!string.IsNullOrEmpty(SSPI)) { if (SSPI.DynamicConvert <bool>()) { conn += ";Integrated Security=SSPI"; } } return(conn); }