0
votes

I have a .Net Core website and Xamarin app that talk to Documentdb and we are preparing to go to production.

All docs I have seen on DocumentDB / CosmosDB hard copy the Key and Endpoint in a C# class. Example: https://docs.microsoft.com/en-us/azure/cosmos-db/tutorial-develop-documentdb-dotnet , http://www.dotnetcurry.com/windows-azure/1395/cosmosdb-webapi-angular-client , to list a few (!), and Azure Security in DocumentDB does not seem to address or mention this issue.

Is there a way to securely store DocuementDB EndPoint and Key in client apps? Thank you.

2

2 Answers

2
votes

You should never use the keys in applications. Azure Key Vault solve this problem.

Please check this

https://sarosh.wordpress.com/2017/11/23/cosmos-db-and-key-vault/

HTH

0
votes

KeyChain.Net

A simple and unified api that enables developer to set, update, get and delete keys and passwords on the keyChain (supports iOS, Android, and WinPhone)

https://github.com/has-taiar/KeyChain.Net

iOS

var helper = new KeyChain.Net.XamarinIOS.KeyChainHelper();
var isSaved = helper.SetKey("myKey", "myKeyValue");
var keyValue = helper.GetKey("myKey");
var isDeleted = helper.DeleteKey("myKey");

Android

var helper = new KeyChain.Net.XamarinAndroid.KeyChainHelper(myActivity, "myKeyProtectionPassword");
var isSaved = helper.SetKey("myKey", "myKeyValue");
var keyValue = helper.GetKey("myKey");
var isDeleted = helper.DeleteKey("myKey");

Windows Phone

var helper = new KeyChain.Net.XamarinWinRT.KeyChainHelper();
var isSaved = helper.SetKey("myKey", "myKeyValue");
var keyValue = helper.GetKey("myKey");
var isDeleted = helper.DeleteKey("myKey");