Skip to content

Commit edb7286

Browse files
committed
added AesGcmEncryptedFileIoProcessor doc snippet
1 parent 5bea1bb commit edb7286

File tree

1 file changed

+18
-0
lines changed
  • data-capture-ready-to-use-ui-example/app/src/main/java/io/scanbot/example/doc_code_snippet/storage

1 file changed

+18
-0
lines changed

data-capture-ready-to-use-ui-example/app/src/main/java/io/scanbot/example/doc_code_snippet/storage/StorageSnippet.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,24 @@ fun publicEncryptionParams(context: Context) {
7171
// @EndTag("Public encryption parameters")
7272
}
7373

74+
fun aesGcmEncryptedFileIoProcessor(application: Application) {
75+
ScanbotSDKInitializer()
76+
// ...
77+
// @Tag("AesGcmEncryptedFileIoProcessor")
78+
.useFileEncryption(enableFileEncryption = true, fileIOProcessor = AesGcmEncryptedFileIoProcessor(object :
79+
AesGcmKeyProvider {
80+
override fun getAesKeyForContext(
81+
file: String,
82+
keyMode: AesGcmEncryptedFileIoProcessor.AESGCMEncrypterMode,
83+
): ByteArray {
84+
val key = "random_key_for_file_encryption".toByteArray()
85+
return key // return the key for the file
86+
}
87+
}))
88+
// @EndTag("AesGcmEncryptedFileIoProcessor")
89+
.initialize(application)
90+
}
91+
7492
fun publicEncryptionParams(context: Context, source: File) {
7593
// @Tag("Image decryption")
7694
val scanbotSDK = ScanbotSDK(context)

0 commit comments

Comments
 (0)