Yes, if needed, your previous employer will reveal the salary details during the background verification check if it is from an authenticated source. However, they will not disclose the entire breakdown of your salary; only the gross or CTC against the salary statement/breakup provided by you during the interview. A confidentiality agreement will not affect this process; it is for the better prospect of an employee.
If you have provided incorrect information about your salary, you will likely encounter issues because most companies conduct background verifications on Date of Joining (DOJ), Date of Leaving (DOL), Department, Designation, Salary, and conduct for a better understanding.
Regards