Example #1
0
def new_key((e, n, d)):
    """Create a RSA object from the given parameters."""
    rsa = m2.rsa_new()
    m2.rsa_set_e(rsa, e)
    m2.rsa_set_n(rsa, n)
    m2.rsa_set_d(rsa, d)
    return RSA.RSA(rsa, 1)
Example #2
0
    def get_rsa(self):
        """
        Return the underlying RSA key if that is what the EVP
        instance is holding.
        """
        rsa_ptr = m2.pkey_get1_rsa(self.pkey)
        if rsa_ptr is None:
            raise ValueError("PKey instance is not holding a RSA key")

        rsa = RSA.RSA(rsa_ptr, 1)
        return rsa