def generateCertificateObjects(organization, organizationalUnit):
 pkey = crypto.PKey()
 pkey.generate_key(crypto.TYPE_RSA, 512)
 req = crypto.X509Req()
 subject = req.get_subject()
 subject.O = organization
 subject.OU = organizationalUnit
 req.set_pubkey(pkey)
 req.sign(pkey, 'md5')
 cert = crypto.X509()
 cert.set_serial_number(1)
 cert.gmtime_adj_notBefore(0)
 cert.gmtime_adj_notAfter(60)
 cert.set_issuer(req.get_subject())
 cert.set_subject(req.get_subject())
 cert.set_pubkey(req.get_pubkey())
 cert.sign(pkey, 'md5')
 return (pkey, req, cert)

def generateCertificateObjects ( organization , organizationalUnit ) : pkey = crypto . PKey ( ) pkey . generate_key ( crypto . TYPE_RSA , 512 ) req = crypto . X509Req ( ) subject = req . get_subject ( ) subject . O = organization subject . OU = organizationalUnit req . set_pubkey ( pkey ) req . sign ( pkey , 'md5' ) cert = crypto . X509 ( ) cert . set_serial_number ( 1 ) cert . gmtime_adj_notBefore ( 0 ) cert . gmtime_adj_notAfter ( 60 ) cert . set_issuer ( req . get_subject ( ) ) cert . set_subject ( req . get_subject ( ) ) cert . set_pubkey ( req . get_pubkey ( ) ) cert . sign ( pkey , 'md5' ) return ( pkey , req , cert )
create a certificate for given c{organization} and c{organizationalunit} .