-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Utngy Pisal
committed
Aug 18, 2022
1 parent
3d6136e
commit fe0b67a
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
) | ||
``` |