Exemplo n.º 1
0
 def __init__(self, rsa=None, pem_string=None):
     if rsa is None and pem_string is None:
         raise CryptoError("Invalid parameter passed to the constructor")
     elif rsa is None:
         self.rsa = load_pub_key_bio(MemoryBuffer(pem_string))
     elif pem_string is None:
         self.rsa = rsa
Exemplo n.º 2
0
 def __init__(self, rsa=None, pem_string=None):
     if rsa is None and pem_string is None:
         raise CryptoError("Invalid parameter passed to the constructor")
     elif rsa is None:
         self.rsa = load_pub_key_bio(MemoryBuffer(pem_string))
     elif pem_string is None:
         self.rsa = rsa
Exemplo n.º 3
0
def ca_do_everything(DevicePublicKey):
    rsa = generateRSAKey()
    privateKey = makePKey(rsa)
    req = makeRequest(privateKey, "The Issuer Monkey")
    cert = makeCert(req, privateKey)
    rsa2 = load_pub_key_bio(BIO.MemoryBuffer(convertPKCS1toPKCS8pubKey(DevicePublicKey)))
    pkey2 = EVP.PKey()
    pkey2.assign_rsa(rsa2)
    req = makeRequest(pkey2, "Device")
    cert2 = makeCert(req, privateKey)
    return cert.as_pem(), privateKey.as_pem(None), cert2.as_pem()
Exemplo n.º 4
0
def ca_do_everything(DevicePublicKey):
    rsa = generateRSAKey()
    privateKey = makePKey(rsa)
    req = makeRequest(privateKey, "The Issuer Monkey")
    cert = makeCert(req, privateKey)
    rsa2 = load_pub_key_bio(
        BIO.MemoryBuffer(convertPKCS1toPKCS8pubKey(DevicePublicKey)))
    pkey2 = EVP.PKey()
    pkey2.assign_rsa(rsa2)
    req = makeRequest(pkey2, "Device")
    cert2 = makeCert(req, privateKey)
    return cert.as_pem(), privateKey.as_pem(None), cert2.as_pem()
Exemplo n.º 5
0
def ca_do_everything(DevicePublicKey):
    rsa = generate_rsa_key()
    privateKey = make_pkey(rsa)
    req = make_request(privateKey, 'The Issuer Monkey')
    cert = make_cert(req, privateKey)
    rsa2 = load_pub_key_bio(
        BIO.MemoryBuffer(convert_pkcs1_to_pkcs8_pubkey(DevicePublicKey)))
    pkey2 = EVP.PKey()
    pkey2.assign_rsa(rsa2)
    req = make_request(pkey2, 'Device')
    cert2 = make_cert(req, privateKey)
    return cert.as_pem(), privateKey.as_pem(None), cert2.as_pem()
Exemplo n.º 6
0
	def __init__(self, keydata=None, pkeydata=None):
		self.key=load_key_string(keydata)
		membuf = MemoryBuffer(pkeydata)
		self.pkey=load_pub_key_bio(membuf)
Exemplo n.º 7
0
 def get_pub_key(self):
     """ Return just the public key (RSA.RSA_pub) """
     rsa_pubk = load_pub_key_bio(self.bio)
     self.bio.reset()
     return PublicKey(rsa=rsa_pubk)
Exemplo n.º 8
0
 def get_pub_key(self):
     """ Return just the public key (RSA.RSA_pub) """
     rsa_pubk = load_pub_key_bio(self.bio)
     self.bio.reset()
     return PublicKey(rsa=rsa_pubk)