from Crypto.PublicKey import RSA
pub_key = """
-----BEGIN PGP PUBLIC KEY BLOCK-----
mykeyhere
-----END PGP PUBLIC KEY BLOCK-----
"""
public_key_object = RSA.importKey(pub_key)
This throws the following error - RSA key format is not supported
This is a public PGP key generated with RSA-4096 encryption. I am curious why this library could be throwing errors. Could there be invalid characters in the key? Doesn't look like there are any , no forward slashes or whatnot.
Cryptolibrary is this?.strip()on the key data? As it is, it will now contain a leading and trailing newline.PGP PUBLIC KEYs are explicitly supported; thekey.export_key('PEM')call linked in the docs you paste generates a-----BEGIN RSA PRIVATE KEY-----key.