[android-components](../index.md) / [mozilla.components.lib.dataprotect](index.md) / [generateEncryptionKey](./generate-encryption-key.md)

# generateEncryptionKey

`fun generateEncryptionKey(keyStrength: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`): `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) [(source)](https://github.com/mozilla-mobile/android-components/blob/master/components/lib/dataprotect/src/main/java/mozilla/components/lib/dataprotect/KeyUtils.kt#L15)

Generates a random key of specified [keyStrength](generate-encryption-key.md#mozilla.components.lib.dataprotect$generateEncryptionKey(kotlin.Int)/keyStrength).

### Parameters

`keyStrength` - The strength of the generated key in bits