def rsa_eq ( key1 , key2 ) : pn1 = key1 . public_numbers ( ) pn2 = key2 . public_numbers ( ) # Check if two RSA keys are in fact the same if pn1 == pn2 : return True else : return False
python check rsa private key and public key match
Only works for RSAPublic Keys
def rsa_eq(key1, key2):
    """
    Only works for RSAPublic Keys

    :param key1:
    :param key2:
    :return:
    """
    pn1 = key1.public_numbers()
    pn2 = key2.public_numbers()
    # Check if two RSA keys are in fact the same
    if pn1 == pn2:
        return True
    else:
        return False