Last active
February 3, 2022 02:44
-
-
Save jimlyas/74557b71b5a5abd0534f0678a8392b24 to your computer and use it in GitHub Desktop.
Gist for Security Android Medium
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android { | |
buildTypes { | |
release { | |
debuggable false | |
minifyEnabled true | |
shrinkResources true | |
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | |
signingConfig signingConfigs.release | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val okHttpClient = OkHttpClient.Builder() | |
.certificatePinner(CertificatePinner.Builder() | |
.add( | |
"www.example.com", | |
"sha256/ZC3lTYTDBJQVf1P2V7+fibTqbIsWNR/X7CWNVW+CEEA=" | |
).build() | |
) | |
.build() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final SupportFactory factory = new SupportFactory(SQLiteDatabase.getBytes("userEnteredPassphrase")); | |
final SomeDatabase room = Room.databaseBuilder(activity, SomeDatabase.class, "YourDatabaseName") | |
.openHelperFactory(factory) | |
.build(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class a implements a1 { | |
private final String as = "SomethingImportantTokenHere"; | |
public void e(String e) { | |
if(as==e) { | |
th(); | |
} else { | |
eg(); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SampleClass : SomeInterface { | |
private val someToken = "SomeImportantTokenHere" | |
fun authenticate(token : String) { | |
if(someToken==token){ | |
login() | |
} else { | |
forceLogout() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment