I am having trouble using the rsa module in python, I need to load two public and private keys from a file, this is how I open the private key file for example:
private_key_file = "privKey.pem"
keydata = open(private_key_file).read()
privKey = rsa.PrivateKey.load_pkcs1(keydata, 'PEM')
and I get this error message: ValueError: No PEM start marker "b'-----BEGIN RSA PRIVATE KEY-----'" found
although the file content start with "-----BEGIN RSA PRIVATE KEY-----" one note is that the file does not contain the leading characters b' I don't know where it comes from or whether it's relevant in this particular problem!.
any help would be appreciated