From fe0b67a7bd88b03a48c5452773e93d4076e87609 Mon Sep 17 00:00:00 2001 From: Utngy Pisal Date: Thu, 18 Aug 2022 14:57:10 +0700 Subject: [PATCH] Added README --- .idea/vcs.xml | 6 ++++++ README.md | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 .idea/vcs.xml create mode 100644 README.md diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..8531932 --- /dev/null +++ b/README.md @@ -0,0 +1,56 @@ + + +# HybridCrypto + +HybridCrypto is simple implementation of hybrid cryptography recommended by [OWASP](https://mobile-security.gitbook.io/mobile-security-testing-guide/general-mobile-app-testing-guide/0x04g-testing-cryptography). + +## Usage + +> Step 1: Add this your root build.gradle +```java +repositories { + ... + maven { url "https://jitpack.io" } +} + +``` +> Step 2: Add this your app build.gradle +```java +dependencies { + implementation 'com.github.utngypisal:hybrid-crypto:1.0.0' +} +``` + +> Step 3: Initialize HybridCrypto in your main Application or Activity onCreate() +```kotlin +override fun onCreate() { + val publicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvTtZxoq7IKTwRkADtWix\n" + + "Ryv/CHKK+skNlMMV5G+om75HgHUo8AOzHnj9yUvhcm8Maz46ukxiZsvDPgExu9N1\n" + + "agEm9HHJEZg1VN+2dT+JojODuC3qkF7o94duchQX44gPjyIBEE/113E6fS51SGGm\n" + + "WYrCapSYjNRubB97O1WPm/2nK+A/m9KTtCuIZMp4i/qe4mXCLMRepFO2ORBLD5Ac\n" + + "RU+/tF15IruvaBhZezY+IX571yRao3ZLlVBJtZKU7SHp5udxQ0daRxtsVc9aloC3\n" + + "TRRL8RvFjHyg7V+uSHkg6cN4IIMrTnkwVkn+7BE9KrT7tY8yEkSE8W4WVCDChIRf\n" + + "FwIDAQAB\n" + + HybridCrypto.initialize(HybridCrypto.Configuration.default, publicKey) +} +``` +> Step 4 (Final): Use it wherever you want +```kotlin +HybridCrypto.getInstance() + .encrypt("Hello") + .let { Log.d("Test", it.httpParams.toString()) } +``` + +## Result +Once encryption is successful, you'll get a Http-friendly result object +```kotlin +data class HttpFriendlyResult( + val requestPassword: String, + val iv: String, + val salt: String, + val responsePassword: String, + val encryptedData: String, + val signature: String, +) +``` \ No newline at end of file