Skip to content

Inji 214: Setup Native module for storing keys in hardware key store android#1

Open
tilak-puli wants to merge 31 commits into
developfrom
inji-214
Open

Inji 214: Setup Native module for storing keys in hardware key store android#1
tilak-puli wants to merge 31 commits into
developfrom
inji-214

Conversation

@tilak-puli

Copy link
Copy Markdown

Comment thread package.json
]
},
"dependencies": {
"react-native-secure-keystore": "file:.yalc/react-native-secure-keystore"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be avoided right?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes Krishna. Got added by mistake. I will remove


return KeyGenParameterSpec.Builder(alias, purposes)
.setKeySize(KEY_PAIR_KEY_SIZE)
.setDigests(DIGEST_SHA256, DIGEST_SHA512, DIGEST_SHA1)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should support SHA1 digest

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok. I will remove it.


override fun encryptData(alias: String, data: String): String {
Log.i(logTag, ks.aliases().toList().toString())
val key = getKeyOrThrow(alias)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are exceptions translated to RN layer?

}

override fun generateHmacSha(data: String): ByteArray {
val messageDigest = MessageDigest.getInstance(HMAC_ALGORITHM)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope we know that HMAC SHA256 is different from SHA256. This implementation is simply calculating SHA256 but not HMAC SHA256. HMAC would require a AES key additionally.

tilak-puli added a commit that referenced this pull request Nov 9, 2023
Inji 214: Create Hardware backed  keystore in Android
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants