Code Monkey home page Code Monkey logo

mtls_sample's Introduction

CA signing environment

  1. 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.

  2. 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.

Generate the app client key.

  1. Open the app folder in Android Studio.

  2. Change the server IP address in MainActivity.kt - Set MainActivity.URL to 'https://your local IP address:3000'.

  3. Change MainActivity.DEVICE_ID to a name you prefer, which is the device ID.

  4. 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.

  5. Click the 'Generate Identity Key' button to generate a new key in Hardware KeyStore.

  6. A certificate request will be printed out on the Logcat console.

  7. Save the certificate request to the file ca_signing/your_deivce_id.csr

Issue the certificate

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/

Test the connection

  1. Run the NodeJS test server.
foo@bar:sample_folder$ cd server
foo@bar:sample_folder$ node server.js
  1. Re-launch the app, as a new certificate has been added. Then press the 'Connect' button.

  2. If the mTLS link works, Hello World should pop up.

mtls_sample's People

Contributors

mpp-lewisz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.