Skip to content

Commit

Permalink
Added README
Browse files Browse the repository at this point in the history
  • Loading branch information
Utngy Pisal committed Aug 18, 2022
1 parent 3d6136e commit fe0b67a
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 56 additions & 0 deletions README.md
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,
)
```

0 comments on commit fe0b67a

Please sign in to comment.