Improve api encryption tests