Android
For the SDK to function, you need to generate a malware list that can be used by the SDK, and link some libraries to your project.
Malware list
You can generate the required malware list and key file with the Malware List Encryption Tool that is provided with the SDK product package. Run the java -jar MalwareListEncryptionTool.jar command to view instructions on how to use this tool.
To generate a malware list
Provide a JSON file to the tool:
java -jar MalwareListEncryptionTool.jar -f /path/to/list.json -o output [ { "packageName": "ExamplePackage1", "md5Hash" : "valid-md5-hash", "sha1Hash": "valid-sha1-hash", "sha256Hash": "valid-sha256-hash" } ]The encryption tool also handles null or empty values:
[ { "packageName": null, "md5Hash" : "valid-md5-hash", } ]
This generates the required files:
signed_malware_list.json: encrypted malware list used by the SDK
app_keys.json: keys for using the malware list
client_keys.json: keys that can be used to regenerate malware lists without having to create the app_keys.json file again
Required dependencies and libraries
The following dependencies and libraries are required for the SDK to function:
// WorkManager dependencies
implementation("androidx.work:work-runtime-ktx:2.10.0")
// Kotlin serialization
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.1")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1")
// Android Security Crypto
implementation("androidx.security:security-crypto:1.1.0-alpha06")Integration steps
To use the Malware Detection SDK in your Android project
Locate the app/libs folder in your project, or create one if it does not exist
Link Add MalwareDetectionSDK.aar from the OneSpan Mobile Security Suite package to the app/libs folder.
Add
implementation(files("libs/MalwareDetectionSDK.aar"))to the build.gradle file.Generate the malware list and keys file. See Malware list for more information.
Add the generated malware list (signed_malware_list.json) and keys file (app_keys.json) to your application. You can use the assets folder app/src/main/assets or any other folder.
Initialize the Malware Detection SDK features, using the URI to the files. For more information, see the technical documentation included in the product package.
Malware detection:
MalwareDetection.getInstance(context, appKeysUri, malwareListUri)RAT detection:
RatDetection.getInstance(context)Sideloading detection:
SideLoadingDetection.getInstance(context)
iOS
To use the Malware Detection SDK in your iOS project
Link MalwareDetectionSDK.xcframework from the OneSpan Mobile Security Suite or Project Cyber package to your Xcode project (linked framework and libraries).
You are now ready to use the Malware Detection SDK.