Architect's Log

I'm a Cloud Architect. I'm highly motivated to reduce toils with driving DevOps.

SQLiteのDBファイルを暗号化する

暗号化

パスワードを設定することで暗号化されます。

using (SQLiteConnection connection = new SQLiteConnection()) {
	connection.ConnectionString = "Data Source=[ファイルパス]"
	connection.Open();
	connection.ChangePassword([設定するパスワード]);
}

復号

接続文字列にパスワードを含めます。

using (SQLiteConnection connection
	 = new SQLiteConnection("Data Source=[ファイルパス];password=[パスワード]")) {

	// 何か処理をする

}