if sign and not key.can_sign:
        raise GPGProblem(
            'The key "{}" cannot be used to sign'.format(key.uids[0].uid),
            code=GPGCode.KEY_CANNOT_SIGN)