5 Star 5 Fork 1

HarmonyOS-TPC / ohos-database-sqlcipher

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-3-Clause

ohos-database-sqlcipher

ohos-database-sqlcipher is used for full database encryption.

Usage Instructions

  1. A sample project which provides runnable code examples that demonstrate uses of the classes in this project is available in the sample/ folder.
  2. Create a contract class like below, mentioning the column names
public final class SqlcipherContract {
    public SqlcipherContract() {}
    public static abstract class SqlEntry implements BaseColumns {
        public static final String TABLE_NAME = "news";
        public static final String COLUMN_NAME_ENTRY_ID = "news_id";
        public static final String COLUMN_NAME_TITLE = "title";
        public static final String COLUMN_NAME_SUBTITLE = "subtitle";
    }
}

3)Create a database helper class which extends the sqlcipher SQLiteOpenHelper and uses SQLiteDatabase classes as below.Also mention the absolute path of database.

import net.sqlcipher.database.SQLiteDatabase;
import net.sqlcipher.database.SQLiteOpenHelper;
public class SqlcipherDbHelper extends SQLiteOpenHelper {

4)In the MainAbility class, add the below statement, by passing any random passphrase

SQLiteDatabase db = SqlcipherDbHelper.getInstance(this).getWritableDatabase("passphrase");

Installation Instructions:

  1. For using ohos-database-sqlcipher module in your sample application, add below dependencies:

    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation project(':ohos-database-sqlcipher')
  2. For using ohos-database-sqlcipher in separate application, add the below dependencies and include "ohos-gif-drawable.har" in libs folder of "entry" module:

    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation files('libs/ohos-database-sqlcipher.har')

    Download the har file (https://s01.oss.sonatype.org/content/repositories/releases/io/openharmony/tpc/thirdlib/ohos-database-sqlcipher/1.0.2/ohos-database-sqlcipher-1.0.2.har ), extract the libsqlcipher.so file and add in /libs/arm64-v8a (Create the folder if not present) of entry app in both cases

  3. For using ohos-database-sqlcipher from a remote repository in separate application, add the below dependencies in build.gradle of "entry" module:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
    implementation 'io.openharmony.tpc.thirdlib:ohos-database-sqlcipher:1.0.2'
}

License

The library is licensed under Apache 2.0. The SQLCipher code itself is licensed under a BSD-style license from Zetetic LLC. Finally, the original SQLite code itself is in the public domain.

http://sqlcipher.net Copyright (c) 2010 Zetetic LLC All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the ZETETIC LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY ZETETIC LLC ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ZETETIC LLC BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

简介

ohos-database-sqlcipher is used for full database encryption. 展开 收起
Java
BSD-3-Clause
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/HarmonyOS-tpc/ohos-database-sqlcipher.git
git@gitee.com:HarmonyOS-tpc/ohos-database-sqlcipher.git
HarmonyOS-tpc
ohos-database-sqlcipher
ohos-database-sqlcipher
master

搜索帮助