How to securely access the data from another Drupal instance? I have a site setup which feels fairly unconventional so please bare with me while I try to explain.

I have 2 Drupal sites based on different servers.

The main site (site A) contains the front-end site and holds user data. The second site (site B) is our internal system and has 2 databases. This is a standard Drupal db and a db that contains other customer data (e.g. sales information, downloads and product info etc).

When a user logs in to their account on the main site, I need to be able to access information on the second database and display this to the user.

I know I can do this without using Drupal with a mysqli statement. However, I need to be able to access this information securely via SSL.

I have very little knowledge of encryption so my initial thought was that if both sites had SSL, the information received would be sent encrypted when using mysqli. However, I think I am very wrong.

My next thought would be to request the information via the second Drupal site perhaps via an API of some sort. However I'm not sure this would offer any more security or if I have missed the point entirely.

Would anyone be able to advise me on the best way access this information please?
The easiest way to do this would be to set up a new MySQL user on Server B that had something like: GRANT SELECT ON serverBdata TO 'serverAuser'@'serverA-IP';

Then you can write a module on server A that connects and retrieves that data.

If that's not going to work, you can look at setting up a menu hook on Server B that delivers the data in a sensible way, such as JSON, over HTTPS. 

if you wanted to get really fancy, you could also encrypt the JSON.