/// <summary> /// Calculates a user-authentication key using the specified token and password /// </summary> /// <param name="authToken">The token to calculate the authentication key</param> /// <param name="password">The password for calculating the authentication key</param> /// <returns>Returns a user authentication key based on the specified token and password</returns> protected static string calculateUserAuthKey(string authToken, SecureString password) { //get the salt as bytes from the token byte[] salt = authToken.GetBytesBase64(); //check if salt ans password have valid values if (salt == null || password.IsNullOrEmpty()) { return ""; } //calculate key else { return getSaltedHashString(password.Unwrap(), salt); } }