Preparation of esters of nitric acid