M2Crypto.X509.Request

Here are the examples of the python api M2Crypto.X509.Request taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

0 Source : snippet.py
with Apache License 2.0
from dockerizeme

def mk_request(bits, cn='localhost'):
	"""
	Create a X509 request with the given number of bits in they key.
	Args:
	  bits -- number of RSA key bits
	  cn -- common name in the request
	Returns a X509 request and the private key (EVP)
	"""
	pk = EVP.PKey()
	x = X509.Request()
	rsa = RSA.gen_key(bits, 65537, lambda: None)
	pk.assign_rsa(rsa)
	x.set_pubkey(pk)
	name = x.get_subject()
	name.C = "US"
	name.CN = cn
	name.ST = 'CA'
	name.O = 'yelp'
	name.OU = 'testing'
	x.sign(pk,'sha1')
	return x, pk


def mk_cacert():