問題描述
我已經
1. 谷歌搜索
2. 在 stackoverflow
上3.我的帖子給我的一些建議,不要使用從App到SQL Server的直接連接自由文本語句,而不是使用大多數推薦的REST API服務.
I have already
1. Searched on google
2. Here on stackoverflow
3. Some recommendations for me on my posts, that not to use direct connections free text statements from App to SQL Server, rather than to use mostly recommended REST API services.
概述
我發現在 Xamarin Forms 開發中 SQL Server 連接非常流暢.我的主要項目是基于 web 的 asp.net c# 和基于桌面的 vb.net,它們使用相同的托管 MS SQL Server 2012 Express(虛擬專用服務器而不是共享服務器)數據庫.
Overview
I find SQL Server connection very smooth in Xamarin Forms development. My major projects are web based asp.net c# and desktop based vb.net which use same Hosted MS SQL Server 2012 Express (Virtual Private Server and not shared server) Database.
在桌面中,我們可以選擇對 app.Config 文件進行加密,我們可以在其中存儲數據庫連接安全憑據.
在基于 Web 中,我們有 web.config 文件,我們說它以安全的方式將憑據放在那里.
(如有錯誤請指正)
坦率地說,我在初始階段嘗試過 REST API 服務,包括 Microsoft Azure,但它看起來非常復雜,或者在方法或薪酬結構上對我來說有一些或其他限制.(或者說我現在在 c# 常規語句中完全靈活).由于我擁有自己的托管服務器,我不想再選擇其他任何服務器.
In Desktop we have option such encrypting the app.Config file where we can store the database connection secure credentials.
In Web-based we have web.config file where we say its secured way to put credentials there.
(If wrong please correct me)
Frankly I tried at initial stage REST API Services including Microsoft Azure but it looks very complex or some or other limitations for me in approach or pay strucure. (Or say may be I totally am now flexible in c# regular statements).
As I am having own Hosting Server I don't want to choose again any other.
終于到了我的查詢
現在我將所有安全憑據存儲在 .cs 中的 Xamarin Forms Class 文件夾中.
Finally to my query
Now I store in Xamarin Forms Class folder in .cs all secure credentials.
/------------------------------------------
//Connection String
//------------------------------------------
public static string appNutri_connection_string = @"data source=<IP ADDRESS>;initial catalog=<Database_Name>;user id=<user_name>;password=<pass_word>;Connect Timeout=600"
我在整個項目中使用這個 appNutri_connection_string 進行連接.
此外,當我們編譯包時,我們會選擇在分發前首先輸入密碼.
不僅如此,在我們將其上傳到 Google Play 之前,它還會重新檢查哈希密鑰憑據和相應的包名稱,然后僅發布 apk.
And I use this appNutri_connection_string throughout project for connections.
Also when we compile the Package we are opted first to enter password before distribution.
Not only that before we upload it on Google Play, it rechecks Hash Key credentials respective package name, then only it publish the apk.
所以請讓我知道 APK 在 .cs 文件中存儲憑據是多么不安全.其次,最重要的是有沒有其他解決方案來加密憑證文件?這樣我就不需要打破我在所有平臺上如此平穩的趨勢.
So please let me know how is not safe for APK to store credentials in .cs file. Secondly , most important is there any other solution to encrypt the credentials file? So that I do not need to break my so smooth trend going on all platforms.
這對我來說是一個非常關鍵的階段,因為我仍處于產品實時實施的初始階段.所以不想走得更遠,有任何漏洞或錯誤的看法.數據(尤其是客戶)安全和隱私是我的主要任務.任何時候都不能妥協.所以請建議我完成這項任務的最佳方式.
(再次可能是一個可能重復的問題,但坦率地說,我沒有找到詳細的解釋或信息,也沒有在此處或任何谷歌搜索中找到)
推薦答案
由于您正處于產品生命周期的初始階段,請更改您的架構!永遠不要,神經直接從外部連接到敏感數據庫 - 在公共客戶端和您的數據庫之間至少放置一個前端層(例如 API).
As you are in very initial stage of your product lifetime, PLEASE CHANGE YOUR ARCHITECTURE! Never, nerver connect directly to a sensitive database from outside - put at least a front-end layer (eg. API) between public clients and your database.
這篇關于Xamarin 表單 (Visual Studio 2017) Android.在應用程序中存儲 SQL Server 數據庫憑據有多安全?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!