I'm thinking of creating a website where the user can create an account and upload his ebooks (pdf format) and read it from the site from wherever device his logged in to and I'm wondering is it legal to give the ability to the user to upload a copyrighted book that he purchased considering that he's the only one who can see he's ebooks plus should these files be encrypted in the database in case of a data breach.
A more general version of the question, as far as I can see, is "Is Google Drive legal?". I can create an account and upload files to Google Drive, and I can open them from the cloud using various interfaces. I can directly open only certain files types, others I have to download to the device that I'm using in order to open the file. There are various file storage systems that allow this, most or all of which seem to use some sort of system of password access, file-access permissions and encryption to block access by unauthorized individuals. All systems seems to allow "sharing" of a specified file.
Google and colleague escape liability by complying with 17 USC 512 aka the DMCA safe harbor provisions. Basically, they don't know, they don't select uploads, they have a removal procedure, they don't know that the material is infringing, and they "are not aware of facts or circumstances from which infringing activity is apparent". There is a chance that you would be sued for inducing copyright infringement, see MGM Studios, Inc. v. Grokster, Ltd, specifically
We hold that one who distributes a device with the object of promoting its use to infringe copyright, as shown by clear expression or other affirmative steps taken to foster infringement, is liable for the resulting acts of infringement by third parties
You describe a situation that is unlikely to be found to constitute inducement to infringing, instead it is "enabling possible infringing", and mere possibilty of doing something bad with a tool does not make you liable for selling a tool, under current US law. An eyebrow would be raised, though, as to why this service only allows ebooks to be deposited.