An Indian diplomat has been formally charged with spying for India 's longtime rival Pakistan .