Skip to content

Commit e9530cf

Browse files
authored
M
V2 FIXED AES GCM BETTER ENCRYPTION
1 parent ed91361 commit e9530cf

61 files changed

Lines changed: 2226 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

comencryptbwt/app/build.gradle.kts

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
plugins {
2+
id("com.android.application")
3+
id("org.jetbrains.kotlin.android")
4+
}
5+
6+
android {
7+
namespace = "com.encrypt.bwt"
8+
compileSdk = 34
9+
10+
defaultConfig {
11+
applicationId = "com.encrypt.bwt"
12+
minSdk = 26
13+
targetSdk = 34
14+
versionCode = 1
15+
versionName = "1.0"
16+
17+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
18+
}
19+
20+
compileOptions {
21+
sourceCompatibility = JavaVersion.VERSION_17
22+
targetCompatibility = JavaVersion.VERSION_17
23+
}
24+
kotlinOptions {
25+
jvmTarget = "17"
26+
}
27+
28+
buildFeatures {
29+
compose = true
30+
viewBinding = true
31+
}
32+
33+
composeOptions {
34+
kotlinCompilerExtensionVersion = "1.5.3"
35+
}
36+
37+
buildTypes {
38+
getByName("release") {
39+
// Habilitamos ProGuard/R8
40+
isMinifyEnabled = true // Para ofuscar el código
41+
isShrinkResources = true // (Opcional) Quitar recursos no usados
42+
43+
// Usamos el archivo ProGuard por defecto + nuestro archivo
44+
proguardFiles(
45+
getDefaultProguardFile("proguard-android-optimize.txt"),
46+
"proguard-rules.pro"
47+
)
48+
}
49+
50+
// Si quieres un build "debug" sin ofuscar, no cambies nada aquí
51+
}
52+
}
53+
54+
dependencies {
55+
implementation("com.google.code.findbugs:jsr305:3.0.2")
56+
// Core
57+
implementation("androidx.core:core-ktx:1.10.1")
58+
implementation("androidx.appcompat:appcompat:1.6.1")
59+
implementation("com.google.android.material:material:1.9.0")
60+
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
61+
62+
// Compose (opcional)
63+
implementation("androidx.activity:activity-compose:1.7.2")
64+
implementation("androidx.compose.ui:ui:1.5.3")
65+
implementation("androidx.compose.material:material:1.5.3")
66+
implementation("androidx.compose.material3:material3:1.2.0")
67+
implementation("androidx.compose.ui:ui-tooling-preview:1.5.3")
68+
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.1")
69+
debugImplementation("androidx.compose.ui:ui-tooling:1.5.3")
70+
71+
// BouncyCastle u otras libs de cifrado
72+
implementation("org.bouncycastle:bcprov-jdk15on:1.70")
73+
74+
// EncryptedSharedPreferences
75+
implementation("androidx.security:security-crypto:1.1.0-alpha03")
76+
77+
// Gson para serializar/deserializar las claves
78+
implementation("com.google.code.gson:gson:2.10.1")
79+
80+
// Test
81+
testImplementation("junit:junit:4.13.2")
82+
androidTestImplementation("androidx.test.ext:junit:1.1.5")
83+
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
84+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
###############################################################################
2+
## ProGuard / R8 rules
3+
###############################################################################
4+
5+
#--------------------------------------------------
6+
# 1) MANTENER Actividades, servicios, y clases que
7+
# forman parte del entry point de Android.
8+
# Ajusta el package a tu proyecto (com.encrypt.bwt).
9+
#--------------------------------------------------
10+
-keep class com.encrypt.bwt.** {
11+
<init>();
12+
}
13+
14+
#--------------------------------------------------
15+
# 2) ViewBinding / DataBinding
16+
# Mantiene clases generadas por el binding,
17+
# y evita problemas con reflexiones internas.
18+
#--------------------------------------------------
19+
-keep class **ViewBinding
20+
-keep class **ViewDataBinding
21+
-keep class androidx.databinding.** { *; }
22+
23+
#--------------------------------------------------
24+
# 3) Mantener las anotaciones (por ejemplo para
25+
# inyección de dependencias o Compose).
26+
#--------------------------------------------------
27+
-keepattributes *Annotation*
28+
29+
#--------------------------------------------------
30+
# 4) GSON
31+
# Si usas GSON para serializar 'KeyItem' u otras
32+
# clases, conviene mantener sus campos si GSON
33+
# hace reflexiones en runtime para parsear JSON.
34+
# -keep class com.encrypt.bwt.KeyItem { *; }
35+
#
36+
# O, si no quieres que se renombre,
37+
# -keep class com.encrypt.bwt.** implements java.io.Serializable { *; }
38+
# Pero en muchos casos GSON sigue funcionando si
39+
# no usas reflection de campos private.
40+
# Ajusta segun convenga.
41+
#--------------------------------------------------
42+
-keep class com.google.gson.** { *; }
43+
-dontwarn com.google.gson.**
44+
45+
# (Opcional) si tus modelos se parsean con GSON por reflection:
46+
# -keepclassmembers class com.encrypt.bwt.** {
47+
# <fields>;
48+
# }
49+
50+
#--------------------------------------------------
51+
# 5) PBKDF2 + javax.crypto + SecureRandom
52+
# Normalmente no hace falta,
53+
# pero si quieres evitar warnings:
54+
#--------------------------------------------------
55+
-dontwarn javax.crypto.**
56+
-dontwarn java.security.**
57+
-dontwarn org.bouncycastle.** # Por si usas BouncyCastle en otra parte
58+
59+
#--------------------------------------------------
60+
# 6) Jetpack Compose (si tuvieras Compose).
61+
# Para evitar warnings y mantener lo esencial:
62+
#--------------------------------------------------
63+
-dontwarn androidx.compose.**
64+
-keep class androidx.compose.runtime.** { *; }
65+
-keep class androidx.compose.ui.** { *; }
66+
67+
#--------------------------------------------------
68+
# 7) Remover logs de linea si lo deseas
69+
# -renamesourcefileattribute SourceFile
70+
# -keepattributes SourceFile,LineNumberTable
71+
#
72+
# Queda a tu criterio.
73+
# Podrías hacer la app más "opaca" para debugging.
74+
#--------------------------------------------------
75+
76+
#--------------------------------------------------
77+
# 8) Overaggressive rename
78+
# -overloadaggressively
79+
# Solo si quieres agresividad mayor.
80+
# Puede romper ciertos Reflection. Úsalo con cuidado.
81+
#--------------------------------------------------
82+
83+
###############################################################################
84+
## FIN
85+
###############################################################################
3.44 MB
Binary file not shown.
4.48 KB
Binary file not shown.
4.4 KB
Binary file not shown.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"version": 3,
3+
"artifactType": {
4+
"type": "APK",
5+
"kind": "Directory"
6+
},
7+
"applicationId": "com.encrypt.bwt",
8+
"variantName": "release",
9+
"elements": [
10+
{
11+
"type": "SINGLE",
12+
"filters": [],
13+
"attributes": [],
14+
"versionCode": 1,
15+
"versionName": "1.0",
16+
"outputFile": "app-release.apk"
17+
}
18+
],
19+
"elementType": "File",
20+
"baselineProfiles": [
21+
{
22+
"minApi": 28,
23+
"maxApi": 30,
24+
"baselineProfiles": [
25+
"baselineProfiles/1/app-release.dm"
26+
]
27+
},
28+
{
29+
"minApi": 31,
30+
"maxApi": 2147483647,
31+
"baselineProfiles": [
32+
"baselineProfiles/0/app-release.dm"
33+
]
34+
}
35+
],
36+
"minSdkVersionForDexing": 26
37+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.example.bwt
2+
3+
import androidx.test.platform.app.InstrumentationRegistry
4+
import androidx.test.ext.junit.runners.AndroidJUnit4
5+
6+
import org.junit.Test
7+
import org.junit.runner.RunWith
8+
9+
import org.junit.Assert.*
10+
11+
/**
12+
* Instrumented test, which will execute on an Android device.
13+
*
14+
* See [testing documentation](http://d.android.com/tools/testing).
15+
*/
16+
@RunWith(AndroidJUnit4::class)
17+
class ExampleInstrumentedTest {
18+
@Test
19+
fun useAppContext() {
20+
// Context of the app under test.
21+
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22+
assertEquals("com.example.comencryptbwt", appContext.packageName)
23+
}
24+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
package="com.encrypt.bwt"
5+
xmlns:tools="http://schemas.android.com/tools">
6+
7+
<application
8+
android:allowBackup="true"
9+
android:icon="@mipmap/ic_launcher"
10+
android:label="@string/app_name"
11+
android:roundIcon="@mipmap/ic_launcher_round"
12+
android:supportsRtl="true"
13+
android:theme="@style/Theme.Encryption">
14+
15+
<!-- Actividad principal de tu app -->
16+
<activity
17+
android:name=".MainActivity"
18+
android:exported="true">
19+
<intent-filter>
20+
<action android:name="android.intent.action.MAIN"/>
21+
<category android:name="android.intent.category.LAUNCHER"/>
22+
</intent-filter>
23+
</activity>
24+
25+
<!-- Actividad para ENCRIPTAR texto seleccionado (ACTION_PROCESS_TEXT) -->
26+
<activity
27+
android:name=".EncryptProcessActivity"
28+
android:label="@string/action_encrypt_label"
29+
android:exported="true"
30+
tools:ignore="AppLinkUrlError">
31+
<intent-filter>
32+
<action android:name="android.intent.action.PROCESS_TEXT"/>
33+
<category android:name="android.intent.category.DEFAULT"/>
34+
<data android:mimeType="text/plain"/>
35+
</intent-filter>
36+
</activity>
37+
38+
<!-- Actividad para DESENCRIPTAR texto seleccionado (ACTION_PROCESS_TEXT) -->
39+
<activity
40+
android:name=".DecryptProcessActivity"
41+
android:label="@string/action_decrypt_label"
42+
android:exported="true"
43+
tools:ignore="AppLinkUrlError">
44+
<intent-filter>
45+
<action android:name="android.intent.action.PROCESS_TEXT"/>
46+
<category android:name="android.intent.category.DEFAULT"/>
47+
<data android:mimeType="text/plain"/>
48+
</intent-filter>
49+
</activity>
50+
51+
<!-- ACTIVIDAD para ENCRIPTAR al COMPARTIR (ACTION_SEND) -->
52+
<activity
53+
android:name=".EncryptShareActivity"
54+
android:label="@string/share_encrypt_label"
55+
android:exported="true">
56+
<intent-filter>
57+
<action android:name="android.intent.action.SEND"/>
58+
<category android:name="android.intent.category.DEFAULT"/>
59+
<data android:mimeType="text/plain"/>
60+
</intent-filter>
61+
</activity>
62+
63+
<!-- ACTIVIDAD para DESENCRIPTAR al COMPARTIR (ACTION_SEND) -->
64+
<activity
65+
android:name=".DecryptShareActivity"
66+
android:label="@string/share_decrypt_label"
67+
android:exported="true">
68+
<intent-filter>
69+
<action android:name="android.intent.action.SEND"/>
70+
<category android:name="android.intent.category.DEFAULT"/>
71+
<data android:mimeType="text/plain"/>
72+
</intent-filter>
73+
</activity>
74+
75+
<!-- NUEVA: Activity para administrar las claves (KeyManagerActivity) -->
76+
<activity
77+
android:name=".KeyManagerActivity"
78+
android:label="@string/manage_keys_title"
79+
android:exported="true">
80+
</activity>
81+
82+
</application>
83+
84+
</manifest>
528 KB
Loading

0 commit comments

Comments
 (0)