GithubHelp home page GithubHelp logo

ledgerhq / ledger-javacard Goto Github PK

View Code? Open in Web Editor NEW
141.0 141.0 64.0 367 KB

Ledger Unplugged - Java Card implementation of Ledger Bitcoin Hardware Wallet

Home Page: https://ledger.co

License: GNU Affero General Public License v3.0

Shell 1.00% Java 99.00%
infraprj-4968

ledger-javacard's Introduction

Ledger Unplugged - Open Source Java Card applet

Overview

This applet is an implementation of the Ledger Wallet Hardware Wallet specification emulating an NFC Forum Type 4 tag to display the second factor, with specific extensions

It is compatible with the core API with a few limitations if not using a proprietary API to recover public keys - the public key cache needs to be provisioned from the client side.

A demonstration of this application and workaround if no proprietary API is present is provided in the Python API and also in Mycelium

Several other integration examples are provided on Ledger Unplugged product page

Developers can also check if a Java Card platform is supported and its performance with the Eligibility applet

All applet code is provided under the GNU Affero General Public License v3 - for any question or commercial licensing, reach us at [email protected]

Differences with Ledger Unplugged commercial versions

Ledger Unplugged sold by Ledger on the Fidesmo platform or downloaded on a Fidesmo enabled device includes an NXP implementation of the ProprietaryAPI interface which is only available under NDA, providing better performance regarding the speed of cryptographic operations.

Users are free to switch between the commercial version and their own version compiled from those sources, after deleting it.

The commercial version is also provisioned with an attestation key pair signed by a shared Ledger public key (see below) allowing a third party to check for genuine applications.

Building

Due to heavy optimizations using a C preprocessor, building is currently recommended on a Unix platform or with MinGW on Windows. Pre built files are provided for reference only.

If you don't need to rebuild the preprocessed files, you can use an automated build with Ant. Otherwise, keep reading.

First download a recent Java Card SDK (at least 3.0.1) from Oracle and install it

Then choose a building script - if building for an NFC only platform, build-no-ndef.sh is recommended. If you wish to test the NDEF second factor (typically on a platform supporting both NFC and a different interface), you can use build.sh instead

Then modify the build script to point JCENV to the installation directory, and possibly the applet and ELF AIDs if necessary. For example Fidesmo mandates a specific AID according to your account configuration.

Finally run the build script to generate a loadable .cap file in the build/ directory

Installing

Installing on a generic Java Card platform

Installation can be done using global platform tools such as GlobalPlatformPro or GPShell

Specific optional installation parameters are described in the Java Card application specification

Installing on a Fidesmo device

First you'll need to register a Fidesmo account

Then you can use Fidesmo API to upload the generated CAP file, and create a recipe to install and delete the application

You can use the following samples

For the App Description

{
    	"name": "Ledger Unplugged Development",
    	"description": {
		"en": "Test Ledger Unplugged application"
    	}
}

For a service recipe to install the application (without installation parameters), replacing with your AIDs, provided by Fidesmo

{
	"description": {
	"title": "Install Ledger Unplugged",
	"description": [{
  		"lang": "en",
      "value": "Test Ledger Unplugged install"
	  }
	],
  },
	"actions": [
    {
        "endpoint": "/ccm/install",
        "content": {
            "executableLoadFile" : "a0000006170054bf6aa95001",
            "executableModule" : "a0000006170054bf6aa94901",
            "application" : "a0000006170054bf6aa94901"
        }
    }
  ],
  "successMessage": "Application was installed",
  "failureMessage": "Application couldn't be installed"	  
}

For a service recipe to delete the application

{
	"description": {
		"title": "Delete Ledger Unplugged",
		"description": [{
  			"lang": "en",
  			"value": "Delete Test Ledger Unplugged"
  		}
	]
  	},
	"actions": [
	    {
    	    "endpoint": "/ccm/delete",
        	"content": {
            	"application" : "a0000006170054bf6aa95001",
            	"withRelated" : true
        	}
    	}
	],
	"successMessage": "Application was deleted",
	"failureMessage": "Application couldn't be deleted"
}

Personalizing

Manual personalization

To perform a manual personalization, you'll need at least to :

  • Select the application AID
  • Issue a FACTORY INITIALIZE KEYCARD SEED command
  • Issue a SETUP command

Personalization through Ledger Wallet Android application

You'll need to rebuild a version of Ledger Wallet application with your specific AID

Using the application

Mycelium

Mycelium supports natively custom built versions of the application - just specify your instance AID in the Settings menu on the Ledger options group.

Ledger public key

Each unique attestation public key is signed by the following Ledger public key on SECp256k1 for official applications

045f68bcd470ba883aa646d90fd8cfee7ac3208e3a1e926bd6895eba5ae22bcd96ddeba7dfe25c7cec546f0f425b9d737de47302bf604f33fa5097a9992b4baf06

ledger-javacard's People

Contributors

btchip avatar martinpaljak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ledger-javacard's Issues

Open question: why was this product/codebase discontinued?

The product (ledger unplugged) seemed to be well reviewed, and javacard is obviously a solid well tested technology. Why was this discontinued? I can't find any explanation. If there were technical reasons, it would be good to know. However, if it was lack of iphone compatibility, that makes sense.

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.