title: How can an application store secrets in Google Cloud Datastore securely?
body: <p>I am building an application that will run on Google App Engine (GAE).  It will need access to data stored by the user in other systems (e.g. the user's Nest thermostat, Yahoo mail).  The application running on GAE will allow the user to provide credentials for the other system.  The application will store these credentials in Google Cloud (Datastore) for later use by an application running on Google Compute Engine on the users behalf.   The application will also allow OAuth to allow the user to allow the application access the external system in the user's behalf.  The application will need to store user credentials (username and passwords) or OAuth access tokens in the Google Cloud.</p>
  
  <p>The application will need to encrypt the secrets before they are stored and be able to unencrypt the data to send it to the external systems.  That is, the system will need to use symmetric encryption and therefor need to securely manage keys.</p>
  
  <p>How can the application store these secrets in the Google Cloud Datastore (Datastore) securely?  I think I am looking for something like the AWS CloudHSM for Google.  That is, I would like to store each secret with a seed and key id and use the key id to get the key from a key management system.  This implementation would also allow for key rotation and other standard security practices.</p>
  
  <p>I think I am looking for a Google Cloud service or Google API that provides secrets management and only allows an app with the proper Google app identifier to access the secrets.</p>
  
  <p>Is there a service within Google Cloud or Google APIs that will manage secrets?  Is there another architecture that I should be considering?</p>
  
  <p>By the way, the application uses Google Identity Toolkit (GitKit) to authenticate and authorize users to use the GAE hosted application.  The application allows users to create accounts using either federate identities or username and passwords via GitKit.</p>
  
  <p>Thanks,
  chris</p>