-
Option 1 - Follow Create Security Certificates using OpenSSL to create a CA signing environment. So that you can issue certificates to your KEYs, you need to create one node key for the TLS server.
-
Option 2 - You can use the ca_signing folder as is.
Please delete and re-create the ca_signing folder if you choose option 1.
-
Open the app folder in Android Studio.
-
Change the server IP address in MainActivity.kt - Set MainActivity.URL to 'https://your local IP address:3000'.
-
Change MainActivity.DEVICE_ID to a name you prefer, which is the device ID.
-
Run the app on an actual device or an emulator. If the app runs on an actual device, the device has to be on the same WiFi network with the TLS server running on your laptop.
-
Click the 'Generate Identity Key' button to generate a new key in Hardware KeyStore.
-
A certificate request will be printed out on the Logcat console.
-
Save the certificate request to the file ca_signing/your_deivce_id.csr
foo@bar:sample_folder$ cd ca_signing
foo@bar:sample_folder$ ./create_certificate.sh your_device_ID
A certificate your_deivce_ID.pem is created in the folder ca_signing/certs. Copy the file to the Android Project assets folder - sample_app/app/src/main/assets.
foo@bar:ca_signing$ cp certs/lewis.pem ../sample_app/app/src/main/assets/
- Run the NodeJS test server.
foo@bar:sample_folder$ cd server
foo@bar:sample_folder$ node server.js
-
Re-launch the app, as a new certificate has been added. Then press the 'Connect' button.
-
If the mTLS link works, Hello World should pop up.