Git Product home page Git Product logo

uicc_identity_toolbox's Introduction

UICC Digital Identity Toolbox

This repository comprises a toolbox of Java Card applets which provide trustworthiness enhancements, based on low-cost and legacy mobile devices, to foundational digital identity platforms.

The aim of this repository is to provide a suite of tools for improving the security, privacy and reliability of authentication mechanisms for foundational national identity platforms. These identity platforms, which can now be found throughout many parts of the developing world, are constrained such that few assumptions should be made about the resources available to their beneficiaries and users. In particular, legacy and low-cost mobile phones are more prevalent than smartphones and there are many areas wirthout reliable access to cellular network operators. In light of these constraints, these tools provide a suite of mechanisms by which low-cost mobile phones can be utilised as authentication tokens within foundational identity platforms. These tools operate despite limited or absent network connectivity and support a wide range of low-cost mobile handsets.

At the moment there are two applets:

  • A QR Code Applet that allows many low-cost mobile devvices to display standard machine-readable Quick Response (QR) codes for authenticating their identity.
  • A Text Applet which provides RFC-4226 HMAC-Based One-Time Passwords (HOTP) on even the most basic handsets.

We are also working towards sound-based and Near-Field Contact (NFC) based solutions which will be added here in due course.

Gratitude

  • This work was supported, in whole or in part, by the Bill & Melinda Gates Foundation [INV-001309].

uicc_identity_toolbox's People

Contributors

hkscy avatar mavroudisv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

celestin

uicc_identity_toolbox's Issues

Build unsuccessful due to changes in `build.xml`

In the latest commit QR_based_applet/build.xml has the following line altered (line 11):

from:
<cap targetsdk="../oracle_javacard_sdks/jc221_kit" jckit="../oracle_javacard_sdks/jc305u3_kit" output="bin/QRSTK.cap" sources="src" classes="bin" version="1.0">

to:

The missing ../ causes the build to fail.

@hkscy is there a specific reason for this (do you have a different local directory structure?), or can we revert?

Adapt `setup_fs.py` for pysim version `1.0`

when running QR_based_applet/host/setup_fs.py

You get an import error like this for newer version of Pysim:

ImportError: cannot import name 'card_handler' from 'pySim.card_handler'

You need to update the host/setup_fs.py file to conform to the current version of pySim. Change two of the import statements as follows (note the inconsistent use of camelcase and underscores):

from pySim.card_handler import CardHandler
from pySim.cards import card_detect, SimCard

and change the use of the (old) card_handler class on line 120:

cardhandler = CardHandler(sl)

Refactor and tidy repository

After chatting with @lukehare, it is apparent that the repo structure is confusing. Below are some notes for cleaning up the repo and ways of working. It is worth spending time on this now because it will only get more cluttered as we go.

  • Ways of working: start using issue tracking more readily, have a develop branch and branch naming fix/XX, feature/XX where <XX> is issue number.
  • Delete unused/commented code. There are also a bunch of development scripts and it is unclear what is necessary and what is development.
  • Update head README in line with Tim's installation notes.
  • There are at least two setup_fs.py files.
  • redundant .gitignore and .gitmodules files
  • we have two host directory. Consider renaming for clarity.
  • in a few places you need to copy and paste simcard related stuff like ADM1 keys. Have a file where you can keep these (and add them to .gitignore) and have the codebase pick them up automatically.
  • should sim-tools be a forked repo then added submodule, rather than a folder?
  • can we have script (e.g. makefile) that automates much of the installation?

Please add to this list.

Setup Virtual Environment solution

There are two virtual environments needed, one for pySim that uses python3, and one for stkp2.

Confusingly you need to use a different environment even in the same subfolder, dependent on the argument (see notes).

I suggest that we use Poetry or pyenv to manage environments, and refactor the repo so that it is clearer what parts of the code need which environments.

Display a QR code as a Multimedia Messaging Service (MMS)

As an alternative to displaying an icon using the STK, it may be possible to use the STK to proactively display an MMS containing a QR code image. This may offer improved image resolutions and flexibility of approach or device support.

Create development environment

In the current workflow you cannot test changes in code until you load the sim into a phone. This is inefficient.

We are attempting to create a dev environment using Eclipse + Javacard plugin.

Ongoing notes here

Optimise `QREncoder.py`

QREncoder takes about 15s.

It would be helpful to optimise this, and we can do it right away (i.e. it doesn't need the Javacard environment).

Implement Crypto algorithms on SIM

Implement crypto algorithms on the SIM.

These are:

  • HOTP
  • ECDSA signing with key derivation on the instance key
  • BSI standard domain-unsinkable sigtnatures

Modify stock Android or FirefoxOS to display full-screen icons

Stock Android and KaiOS do not fully support the display of full-screen icons or images loaded from the SIM card. Android (or FirefoxOS as a proxy for KaiOS compatibility) could be modified to make this possible!

In a bit more detail, the STK implementation for Android can be found at e.g., https://android.googlesource.com/platform/packages/apps/Stk/+/eclair-release/src/com/android/stk/StkDialogActivity.java

If you take a look at e.g., line 95-96, you can see that icon are implemented as:

window.setFeatureDrawable(Window.FEATURE_LEFT_ICON, new BitmapDrawable(mTextMsg.icon));

which means that DISPLAY_TEXT icons are only ever displayed using the Android Window.FEATURE_LEFT_ICON element. This limits their size and usability.

Some specific (unordered and overlapping) tasks are:

  • Modify android or KaiOS DISPLAY_TEXT so that if the icon_replaces_test flag is used in the STK, the icon is drawn 'full screen' or at least largely
  • Create an Android app to display the icon from the SIM, using a different mechanism than the STK
  • Investigate the Android STK to see if there any other ways of displaying an icon that are supported or which we can exploit. DISPLAY_TEXT is not the only command we have access to! (e.g. see play_tone and how that displays the icon differently - https://android.googlesource.com/platform/packages/apps/Stk/+/eclair-release/src/com/android/stk/ToneDialog.java)

Set up Javacard IDE using Eclipse on Azure VM

We would like to set up a Javacard development environment on an Azure VM that we all have access to in order to streamline the development process (currently, this is quite slow as it requires re-building and installing the applet on SIM in order to test, and gives uninformative error messages in case of bugs).

This HackMD contains the steps we have taken so far:
https://hackmd.io/CW_Zw2T1Tje0rOQE4OpaKw?both

Repository Directory Structure

The directory structure should reflect how the repository is intended to be used. And a logical directory structure will help separate, for example, things that need a different environment, are written in a different language, are used for a different purpose, or require a different suite of tests etc.

It is sometimes difficult to come up with a perfectly logical directory structure ahead of time because this is a research project. But it is worth thinking about how we see the code developing.

It seems to me and @lukehare that there are three parts to the repo:

  • git submodules (sim-tools, oracle_javacard_sdks)
  • applets (which is actually the toolbox).
  • utils (this is the root host folder - better name required as I'm not sure how the scripts in this folder are related).

Here are some example directory structures that would be useful and extensible, depending on whether the QR and text applets are ultimately intended to be the same app.

Let's discuss, @hkscy, @mavroudisv, @thobson88

A)

- submodules
    - oracle_**
    - sim-tools ** (fork)
- toolbox
    - QR
        - install
            - poetry.lock / pyenv.version (for easily managing different python requirements)
        - development
            - poetry.lock / pyenv.version
        - applet/java
            - lib
            - src
            - build.xml
        
        - README
    - text
        - install
        - development
        - applet/java
            - lib
            - src
            - build.xml
            - README
    - etc.
    - README
- root-host folder [better name!, utils?]
- highlevel README + installation
- .gitignore
- .gitmodules

B)

- submodules
    - oracle_**
    - sim-tools ** (fork)
- toolbox
    - applet
        - install
        - development
            - QR
            - text
        - java
            - lib
            - src
            - build.xml
    - etc.?
    - README
    
- root-host folder [better name!, utils?]
- highlevel README + installation
- .gitignore
- .gitmodules

Nokia 8110 displays many QR codes

On slack. There is a video showing a weird bug using commit 8f2cfebef78822ecf23cc9c938d2bf3e7d42b90b.

With limited knowledge of the underlying code: the icon buffer doesn't clear and icons accumulate. And bigger icons do not display well.

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.