Enabling a bidirectional energy flow between power grids and plug-in hybrid electric vehicles (PHEVs) using vehicle-to-grid (V2G) and grid-to-vehicle (G2V) communications is considered as one of the key components of the future smart grid. On the one hand, the PHEV owner needs to charge its PHEV through the grid, given possibly time-varying electricity pricing schemes. On the other hand, the energy stored in a PHEV can also be sold back to the grid so as to act as an ancillary service while possibly generating revenues to its owner. Consequently, this motivates the need to develop smart charging policies that enable the PHEV owner to optimally decide on when to charge or discharge its vehicle, while minimizing its long-term energy consumption cost. In this paper, we model this PHEV energy management problem as a Markov decision process (MDP), which is solved by using a linear programming (LP) technique so as to obtain the optimal charging policy. In particular, we devise optimal charging policies that are resilient to the price information attacks such as denial of service (DoS) attacks and price manipulation attacks over the grid's communication network. We show that, under potential price information attacks, each PHEV can optimize its charging policies given only an estimated price information, which leads to a discrepancy between the real and expected costs. To this end, we analyze this cost difference using the proposed MDP model, which can also guide the system designer and administrator to decide whether reinforcing the system's security is required. The simulation results show that the proposed PHEV charging policy is effective and is adaptable to different PHEV mobility patterns, battery levels and varying electricity prices. It is also demonstrated that improving the system's ability to detect and resolve the attack can obviously reduce the impact brought by the attacks.