Skip to content

Commit 80c928a

Browse files
author
Christopher J. Brody
committed
2 parents 01a4edd + 62166f7 commit 80c928a

21 files changed

+234
-255
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: 💬 Community support
4+
url: https://discuss.zetetic.net/c/sqlcipher/5
5+
about: Integration problem or question about SQLCipher for Android, feel free to ask here.
6+
- name: 🔨 Build issue
7+
url: https://discuss.zetetic.net/c/sqlcipher/5
8+
about: Experience an issue building SQLCipher for Android? Start here.
9+
- name: 📃 SQLCipher documentation
10+
url: https://www.zetetic.net/sqlcipher/sqlcipher-api/
11+
about: SQLCipher documentation can be found here.
12+
- name: 📖 Contribution instructions
13+
url: https://www.zetetic.net/contributions/
14+
about: Want to contribute to SQLCipher for Android? Start here.

.github/ISSUE_TEMPLATE/issue.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
name: 🛠️ Bug report
3+
about: Create a report about a software defect
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
---
8+
9+
### Expected Behavior
10+
11+
### Actual Behavior
12+
13+
### Steps to Reproduce
14+
15+
SQLCipher version (can be identified by executing `PRAGMA cipher_version;`):
16+
17+
SQLCipher for Android version:
18+
19+
Are you able to reproduce this issue within the SQLCipher for Android [test suite](https://github.com/sqlcipher/sqlcipher-android-tests)?
20+
21+
*Note:* If you are not posting a specific issue for the SQLCipher library, please post your question to the SQLCipher [discuss site](https://discuss.zetetic.net/c/sqlcipher). Thanks!

.gitmodules

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +0,0 @@
1-
[submodule "android-database-sqlcipher/src/main/external/sqlcipher"]
2-
path = android-database-sqlcipher/src/main/external/sqlcipher
3-
url = https://github.com/sqlcipher/sqlcipher.git
4-
ignore = untracked

Makefile

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,39 @@
33
publish-local-release publish-remote-snapshot public-remote-release check
44
GRADLE = ./gradlew
55

6-
init:
7-
git submodule update --init
8-
96
clean:
107
$(GRADLE) clean
118

129
distclean:
13-
$(GRADLE) distclean
10+
$(GRADLE) distclean \
11+
-PsqlcipherRoot="$(SQLCIPHER_ROOT)"
1412

1513
build-openssl:
1614
$(GRADLE) buildOpenSSL
1715

1816
check:
1917
$(GRADLE) check
2018

21-
build-debug: check
19+
format:
20+
$(GRADLE) editorconfigFormat
21+
22+
build-debug:
2223
$(GRADLE) android-database-sqlcipher:bundleDebugAar \
23-
-PdebugBuild=true
24+
-PdebugBuild=true \
25+
-PsqlcipherRoot="$(SQLCIPHER_ROOT)" \
26+
-PopensslRoot="$(OPENSSL_ROOT)" \
27+
-PopensslAndroidNativeRoot="$(OPENSSL_ANDROID_LIB_ROOT)" \
28+
-PsqlcipherCFlags="$(SQLCIPHER_CFLAGS)" \
29+
-PsqlcipherAndroidClientVersion="$(SQLCIPHER_ANDROID_VERSION)"
2430

25-
build-release: check
31+
build-release:
2632
$(GRADLE) android-database-sqlcipher:bundleReleaseAar \
27-
-PdebugBuild=false
33+
-PdebugBuild=false \
34+
-PsqlcipherRoot="$(SQLCIPHER_ROOT)" \
35+
-PopensslRoot="$(OPENSSL_ROOT)" \
36+
-PopensslAndroidNativeRoot="$(OPENSSL_ANDROID_LIB_ROOT)" \
37+
-PsqlcipherCFlags="$(SQLCIPHER_CFLAGS)" \
38+
-PsqlcipherAndroidClientVersion="$(SQLCIPHER_ANDROID_VERSION)"
2839

2940
publish-local-snapshot:
3041
@ $(collect-signing-info) \
@@ -71,7 +82,12 @@ publish-remote-release:
7182
-PsigningKeyPassword="$$gpgPassword" \
7283
-PnexusUsername="$$nexusUsername" \
7384
-PnexusPassword="$$nexusPassword" \
74-
uploadArchives
85+
-PsqlcipherRoot="$(SQLCIPHER_ROOT)" \
86+
-PopensslRoot="$(OPENSSL_ROOT)" \
87+
-PopensslAndroidLibRoot="$(OPENSSL_ANDROID_LIB_ROOT)" \
88+
-PsqlcipherCFlags="$(SQLCIPHER_CFLAGS)" \
89+
-PsqlcipherAndroidClientVersion="$(SQLCIPHER_ANDROID_VERSION)" \
90+
android-database-sqlcipher:publish
7591

7692
collect-nexus-info := \
7793
read -p "Enter Nexus username:" nexusUsername; \

README.md

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ The latest AAR binary package information can be [here](https://www.zetetic.net/
55

66
### Compatibility
77

8-
SQLCipher for Android runs on Android 4.1–Android 10, for `armeabi-v7a`, `x86`, `x86_64`, and `arm64_v8a` architectures.
9-
8+
SQLCipher for Android runs on Android 4.1–Android 13, for `armeabi-v7a`, `x86`, `x86_64`, and `arm64_v8a` architectures.
9+
1010
### Contributions
1111

1212
We welcome contributions, to contribute to SQLCipher for Android, a [contributor agreement](https://www.zetetic.net/contributions/) needs to be submitted. All submissions should be based on the `master` branch.
@@ -44,7 +44,7 @@ Error: file is encrypted or is not a database
4444

4545
### Application Integration
4646

47-
You have a two main options for using SQLCipher for Android in your app:
47+
You have a two main options for using SQLCipher for Android in your app:
4848

4949
- Using it with Room or other consumers of the `androidx.sqlite` API
5050

@@ -55,11 +55,11 @@ such as having the following line in your module's `build.gradle` `dependencies`
5555
closure:
5656

5757
```gradle
58-
implementation 'net.zetetic:android-database-sqlcipher:4.3.0'
58+
implementation "net.zetetic:android-database-sqlcipher:4.5.2"
5959
implementation "androidx.sqlite:sqlite:2.0.1"
6060
```
6161

62-
(replacing `4.3.0` with the version you want)
62+
(replacing `4.5.2` with the version you want)
6363

6464
<a title="Latest version from Maven Central" href="https://maven-badges.herokuapp.com/maven-central/net.zetetic/android-database-sqlcipher"><img src="https://maven-badges.herokuapp.com/maven-central/net.zetetic/android-database-sqlcipher/badge.svg"></a>
6565

@@ -126,20 +126,31 @@ The rest of your code may not need any changes.
126126

127127
An article covering both integration of SQLCipher into an Android application as well as building the source can be found [here](https://www.zetetic.net/sqlcipher/sqlcipher-for-android/).
128128

129-
### Building
129+
### ProGuard
130130

131-
In order to build `android-database-sqlcipher` from source you will need both the Android SDK, Gradle, and the Android NDK. We currently recommend using Android NDK version `r20`. To complete the `make` command, the `ANDROID_NDK_HOME` environment variable must be defined which should point to your NDK root. Once you have cloned the repo, change directory into the root of the repository and run the following commands:
131+
For applications which utilize ProGuard, a few additional rules must be included when using SQLCipher for Android. These rules instruct ProGuard to omit the renaming of the internal SQLCipher classes which are used via lookup from the JNI layer. It is worth noting that since SQLCipher or Android is based on open source code there is little value in obfuscating the library anyway. The more important use of ProGuard is to protect your application code and business logic.
132132

133133
```
134-
# this only needs to be done once
135-
make init
134+
-keep,includedescriptorclasses class net.sqlcipher.** { *; }
135+
-keep,includedescriptorclasses interface net.sqlcipher.** { *; }
136+
```
137+
138+
### Building
136139

137-
# to build the source for debug:
138-
make build-debug
139-
# or for a release build:
140+
In order to build `android-database-sqlcipher` from source you will need both the Android SDK, Gradle, Android NDK, SQLCipher core source directory, and an OpenSSL source directory. We currently recommend using Android NDK LTS version `23.0.7599858`.
141+
142+
To complete the `make` command, the `ANDROID_NDK_HOME` environment variable must be defined which should point to your NDK root. Once you have cloned the repo, change directory into the root of the repository and run the following commands:
143+
144+
```
145+
SQLCIPHER_ROOT=/some/path/to/sqlcipher-folder \
146+
OPENSSL_ROOT=/some/path/to/openssl-folder \
147+
SQLCIPHER_CFLAGS="-DSQLITE_HAS_CODEC -DSQLITE_TEMP_STORE=2" \
148+
SQLCIPHER_ANDROID_VERSION="4.5.2" \
140149
make build-release
141150
```
142151

152+
You may specify other build flags/features within `SQLCIPHER_CFLAGS`, however, specifying `-DSQLITE_HAS_CODEC` and `-DSQLITE_TEMP_STORE` is necessary in the list of flags.
153+
143154
### License
144155

145156
The Android support libraries are licensed under Apache 2.0, in line with the Android OS code on which they are based. 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.

SQLCIPHER_LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ http://sqlcipher.net
22

33
Copyright (c) 2010 Zetetic LLC
44
All rights reserved.
5-
5+
66
Redistribution and use in source and binary forms, with or without
77
modification, are permitted provided that the following conditions are met:
88
* Redistributions of source code must retain the above copyright
@@ -13,7 +13,7 @@ http://sqlcipher.net
1313
* Neither the name of the ZETETIC LLC nor the
1414
names of its contributors may be used to endorse or promote products
1515
derived from this software without specific prior written permission.
16-
16+
1717
THIS SOFTWARE IS PROVIDED BY ZETETIC LLC ''AS IS'' AND ANY
1818
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1919
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE

android-database-sqlcipher/build-openssl-libraries.sh

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22

33
MINIMUM_ANDROID_SDK_VERSION=$1
44
MINIMUM_ANDROID_64_BIT_SDK_VERSION=$2
5-
OPENSSL=openssl-$3
5+
OPENSSL_DIR=$3
6+
ANDROID_LIB_ROOT=$4
67

7-
(cd src/main/external/;
8-
gunzip -c ${OPENSSL}.tar.gz | tar xf -
9-
)
10-
11-
(cd src/main/external/${OPENSSL};
8+
(cd ${OPENSSL_DIR};
129

1310
if [[ ! ${MINIMUM_ANDROID_SDK_VERSION} ]]; then
1411
echo "MINIMUM_ANDROID_SDK_VERSION was not provided, include and rerun"
@@ -45,7 +42,6 @@ OPENSSL=openssl-$3
4542
esac
4643

4744
NDK_TOOLCHAIN_VERSION=4.9
48-
ANDROID_LIB_ROOT=../android-libs
4945
OPENSSL_CONFIGURE_OPTIONS="-fPIC -fstack-protector-all no-idea no-camellia \
5046
no-seed no-bf no-cast no-rc2 no-rc4 no-rc5 no-md2 \
5147
no-md4 no-ecdh no-sock no-ssl3 \
@@ -55,7 +51,7 @@ OPENSSL=openssl-$3
5551
no-srtp"
5652

5753
rm -rf ${ANDROID_LIB_ROOT}
58-
54+
5955
for SQLCIPHER_TARGET_PLATFORM in armeabi-v7a x86 x86_64 arm64-v8a
6056
do
6157
echo "Building libcrypto.a for ${SQLCIPHER_TARGET_PLATFORM}"
@@ -99,7 +95,7 @@ OPENSSL=openssl-$3
9995
make clean
10096
PATH=${TOOLCHAIN_BIN_PATH}:${PATH} \
10197
make build_libs
102-
98+
10399
if [[ $? -ne 0 ]]; then
104100
echo "Error executing make for platform:${SQLCIPHER_TARGET_PLATFORM}"
105101
exit 1

android-database-sqlcipher/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ android {
2424
buildTypes {
2525
debug {
2626
debuggable true
27+
buildConfigField("String", "VERSION_NAME", "\"${clientVersionNumber}\"")
2728
}
2829
release {
2930
debuggable false
3031
minifyEnabled false
32+
buildConfigField("String", "VERSION_NAME", "\"${clientVersionNumber}\"")
3133
}
3234
}
3335

@@ -51,5 +53,6 @@ android {
5153
check.dependsOn editorconfigCheck
5254
buildNative.mustRunAfter buildAmalgamation
5355
buildAmalgamation.mustRunAfter buildOpenSSL
54-
preBuild.dependsOn([buildOpenSSL, buildAmalgamation, buildNative])
56+
preBuild.dependsOn([buildOpenSSL, buildAmalgamation, copyAmalgamation, buildNative])
57+
buildNative.mustRunAfter(copyAmalgamation)
5558
}

android-database-sqlcipher/maven.gradle

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apply plugin: "maven"
1+
apply plugin: "maven-publish"
22
apply plugin: "signing"
33
import org.gradle.plugins.signing.Sign
44

@@ -36,57 +36,56 @@ gradle.taskGraph.whenReady { taskGraph ->
3636
}
3737
}
3838

39-
afterEvaluate { project ->
40-
uploadArchives {
41-
repositories {
42-
mavenDeployer {
43-
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
44-
45-
pom.groupId = mavenGroup
46-
pom.artifactId = mavenArtifactId
47-
pom.version = mavenVersionName
4839

49-
repository(url: getReleaseRepositoryUrl()) {
50-
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
51-
}
52-
snapshotRepository(url: getSnapshotRepositoryUrl()) {
53-
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
54-
}
55-
56-
pom.project {
57-
name mavenArtifactId
58-
packaging mavenPackaging
59-
description mavenPomDescription
60-
url mavenPomUrl
61-
62-
scm {
63-
url mavenScmUrl
64-
connection mavenScmConnection
65-
developerConnection mavenScmDeveloperConnection
66-
}
6740

41+
afterEvaluate { project ->
42+
publishing {
43+
publications {
44+
mavenJava(MavenPublication) {
45+
from components.release
46+
groupId = mavenGroup
47+
artifactId = mavenArtifactId
48+
version = mavenVersionName
49+
pom {
50+
name = mavenArtifactId
51+
description = mavenPomDescription
52+
url = mavenPomUrl
6853
licenses {
6954
license {
70-
url mavenLicenseUrl
55+
url = mavenLicenseUrl
7156
}
7257
}
73-
7458
developers {
7559
developer {
76-
name mavenDeveloperName
77-
email mavenDeveloperEmail
78-
organization mavenDeveloperOrganization
79-
organizationUrl mavenDeveloperUrl
60+
name = mavenDeveloperName
61+
email = mavenDeveloperEmail
8062
}
8163
}
64+
scm {
65+
connection = mavenScmConnection
66+
developerConnection = mavenScmDeveloperConnection
67+
url = mavenScmUrl
68+
}
8269
}
8370
}
8471
}
72+
repositories {
73+
maven {
74+
def repoUrl = isReleaseBuild()
75+
? getReleaseRepositoryUrl()
76+
: getSnapshotRepositoryUrl()
77+
url = repoUrl
78+
credentials {
79+
username = getRepositoryUsername()
80+
password = getRepositoryPassword()
81+
}
82+
}
83+
}
8584
}
8685

8786
signing {
88-
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
89-
sign configurations.archives
87+
required { isReleaseBuild() && gradle.taskGraph.hasTask("publish") }
88+
sign publishing.publications.mavenJava
9089
}
9190

9291
task androidSourcesJar(type: Jar) {

0 commit comments

Comments
 (0)