(pubkey)
Load public RSA key, with work-around for keys using
    incorrect header/footer format.

    Read more about RSA encryption with cryptography:
    https://cryptography.io/latest/hazmat/primitives/asymmetric/rsa/
Load public RSA key, with work-around for keys using
    incorrect header/footer format.
Load public RSA key with work - around for keys using incorrect header / footer format .
def load_key(pubkey):
    """Load public RSA key, with work-around for keys using
    incorrect header/footer format.

    Read more about RSA encryption with cryptography:
    https://cryptography.io/latest/hazmat/primitives/asymmetric/rsa/
    """
    try:
        return load_pem_public_key(pubkey.encode(), default_backend())
    except ValueError:
        # workaround for https://github.com/travis-ci/travis-api/issues/196
        pubkey = pubkey.replace('BEGIN RSA', 'BEGIN').replace('END RSA', 'END')
        return load_pem_public_key(pubkey.encode(), default_backend())
def load_key ( pubkey ) : try : return load_pem_public_key ( pubkey . encode ( ) , default_backend ( ) ) except ValueError : # workaround for https://github.com/travis-ci/travis-api/issues/196 pubkey = pubkey . replace ( 'BEGIN RSA' , 'BEGIN' ) . replace ( 'END RSA' , 'END' ) return load_pem_public_key ( pubkey . encode ( ) , default_backend ( ) )