generate certificate functions