def sign_certificate_request(keypair, dn, request, serial, validity_period, digest, start=None, additional_extensions=()):
 if (start is None):
  start = datetime.datetime.utcnow()
 expire = (start + datetime.timedelta(seconds=validity_period))
 start = start.strftime('%Y%m%d%H%M%SZ')
 expire = expire.strftime('%Y%m%d%H%M%SZ')
 req = request.original
 cert = crypto.X509()
 cert.set_issuer(dn)
 cert.set_subject(req.get_subject())
 cert.set_pubkey(req.get_pubkey())
 cert.set_notBefore(start)
 cert.set_notAfter(expire)
 cert.set_serial_number(serial)
 cert.add_extensions(additional_extensions)
 cert.sign(keypair.original, digest)
 return Certificate(cert)

def sign_certificate_request ( keypair , dn , request , serial , validity_period , digest , start = None , additional_extensions = ( ) ) : if ( start is None ) : start = datetime . datetime . utcnow ( ) expire = ( start + datetime . timedelta ( seconds = validity_period ) ) start = start . strftime ( '%Y%m%d%H%M%SZ' ) expire = expire . strftime ( '%Y%m%d%H%M%SZ' ) req = request . original cert = crypto . X509 ( ) cert . set_issuer ( dn ) cert . set_subject ( req . get_subject ( ) ) cert . set_pubkey ( req . get_pubkey ( ) ) cert . set_notBefore ( start ) cert . set_notAfter ( expire ) cert . set_serial_number ( serial ) cert . add_extensions ( additional_extensions ) cert . sign ( keypair . original , digest ) return Certificate ( cert )
sign a certificaterequest and return a certificate .