Any party required to give a bond undertaking or other obligation may agree with his surety for the deposit of any money and assets for which the surety is responsible with a bank, savings bank, safe deposit, or trust company authorized by law to do business as such, or other depository approved by the court or a judge thereof, if such deposit is otherwise proper, for the safekeeping of such money and assets and in such manner as to prevent the withdrawal of any or all such money and assets without the written consent of the surety, or an order of court or a judge thereof, made on such notice to the surety as the court or judge may direct. Such agreement shall not in any manner release, or change the liability of, the principal or surety as established by the terms of the bond.