-
Notifications
You must be signed in to change notification settings - Fork 6
flexSecure Quickstart #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dangerous-tac0s
wants to merge
6
commits into
DangerousThings:master
Choose a base branch
from
dangerous-tac0s:quickstart
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c937012
Create quickstart.md
dangerous-tac0s 60aea6e
Update quickstart.md
dangerous-tac0s df9d284
Merge branch 'DangerousThings:master' into quickstart
dangerous-tac0s e587089
Update quickstart.md
dangerous-tac0s 4866dea
Update quickstart.md
dangerous-tac0s 4a479d0
Update quickstart.md
dangerous-tac0s File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
# So you just got a flexSecure | ||
|
||
While there is some overlap with the Apex, app deployment happens quite differently on the flexSecure which relies on Global Platform Pro which is a command line tool. | ||
|
||
This is aimed at getting you up and running as quickly as possible but it is strongly suggested you read the [technology](docs/1-technology.md) and [hardware](docs/2-hardware.md) sections. | ||
|
||
## flexSecure Preloaded Apps | ||
All of these sold after 12/2/2024 come preloaded with FIDO2Applet, javacard-memory, apex-totp, and openjavacard-ndef with a 32k container. | ||
Release v0.19.1: | ||
|App Name |AID |Persistent Storage |Transient Memory | | ||
|-------------------------------------------|---------------------------|---------------------|------------------| | ||
|[JavaCard Memory](https://github.com/DangerousThings/javacard-memory)|A0000008466D656D6F727901|? |? | | ||
|[FIDO2Applet](#FIDO2Applet) |A0000006472F0002 |~41748 bytes |~2745 bytes | | ||
|[Apex TOTP](#apex-totp) |A0000005272101014150455801 |5416 bytes |2344 bytes | | ||
|[Open JavaCard NDEF](#openjavacard-ndef) |D2760000850101 |2428 bytes + 32 kB |0 | | ||
|
||
## Setting up Global Platform Pro | ||
- Windows | ||
- Linux | ||
- OS X | ||
|
||
### Basics | ||
Using the jar or exe, use the following flags: | ||
- Installing an applet | ||
```shell | ||
--install <capfile> | ||
``` | ||
- Uninstalling | ||
```shell | ||
--uninstall <capfile> | ||
or | ||
--remove <capfile or AID> | ||
``` | ||
- List installed applets | ||
```shell | ||
--list | ||
``` | ||
|
||
## Download applets | ||
Check the [latest release](releases) and download the apps you're interested in before proceeding. | ||
|
||
## Apps with a simple install | ||
The following apps can be installed with a single GPP command and the requisite cap file. | ||
### apex-tesla | ||
Use your flexSecure as a Tesla key. | ||
### apex-totp | ||
OTP codes generated in vivo. | ||
### flexsecure-ykhmac | ||
Generate HMAC-SHA1 hashes on the flexSecure. Can be used to secure LastPass. | ||
### javacard-memory | ||
This is used with Apex Manager to provide a rough estimate on available storage. | ||
### openjavacard-ndef | ||
Create NDEF containers up to 32k on the flexSecure. If no parameters are provided, it defaults to a 2k container | ||
- 2k | ||
```cmd | ||
--params 810200F182020800 | ||
``` | ||
- 4k | ||
```cmd | ||
--params 810200F182021000 | ||
``` | ||
- 8k | ||
```cmd | ||
--params 810200F182022000 | ||
``` | ||
- 16k | ||
```cmd | ||
--params 810200F182024000 | ||
``` | ||
- 32k | ||
```cmd | ||
--params 810200F182027fff | ||
``` | ||
|
||
If you want to do other things such as preload data, enable read only or write once modes, [checkout the docs](https://github.com/OpenJavaCard/openjavacard-ndef). | ||
### SatoChipApplet | ||
This allows your flexSecure to act as a cold wallet. Currently, cold wallets are not supported by Sato mobile apps. | ||
### Satodime-Applet | ||
This is not compatible with Apex or flexSecure devices. | ||
### SeedKeeper-Applet | ||
### status-keycard | ||
This allows your flexSecure to act as a cold wallet. Currently, cold wallets are not supported by Status.im mobile apps. | ||
### u2f-javacard | ||
This is unnecessary if the FIDO2 applet is installed. If, however, you want U2F but don't care about passkeys, this will save you storage. | ||
|
||
## Apps with complex install | ||
### [FIDO2Applet](https://github.com/BryanJacobs/FIDO2Applet) | ||
To install this applet, you'll need to generate and load attestation data. You'll need [Python](https://python.org/downloads) and [this repo](https://github.com/dangerousthings/fido-attestation-loader). | ||
- Setup fido-attestation-loader | ||
- Update the update settings.example.ini and save it as settings.ini | ||
- You could generate a new one or use '27291256-2735-45b5-99f9-2863c9dedf72' as we do with the flexSecure we preload. | ||
- Listed metadata, ca, and cert fields are required but they can (mostly) be anything you like. | ||
- description: what device is it? we use flexSecure | ||
- icon: we use a png around 40x40 | ||
- c: country. we use US | ||
- o: organization. we use Dangerous Things | ||
- cn: certificate name. Leave these alone | ||
- Install python packages. This is presently broken. Install cbor2 and then the latest version of the other packages in requirements.txt | ||
```shell | ||
pip install -r "requirements.txt" | ||
``` | ||
- Generate central authority and attestation certificates | ||
You'll want to save the files generated by this as well as the passphrases you use to secure them. To make it easy, you can save the phrases in files called ca_key.pass and attestation_key.pass in the fido-attestation-loader directory. | ||
```shell | ||
python attestation.py ca create | ||
``` | ||
```shell | ||
python attestation.py cert create -m fido21 | ||
``` | ||
```shell | ||
python attestation.py cert validate | ||
``` | ||
```shell | ||
# Example Output | ||
info: Validating an existing attestation certificate against a certificate authority | ||
info: Loading settings file settings.ini | ||
info: Public attestation certificate serial number: 723321508150486599877570106078221356789683409469 | ||
info: Public attestation certificate SHA256 fingerprint: 1c104b3380b028b703f2ab2cc841bfebb966d792f218aa2bb56bd81e88599842 | ||
info: Public certificate authority serial number: 385004152696321157272772190328151754561352515268 | ||
info: Public certificate authority SHA256 fingerprint: 9e8b43d2688663e9937c490bfa0ad4e59cc086d5e96e547f1c1f7ca27e977972 | ||
success: The attestation certificate has a valid signature by the certificate authority | ||
``` | ||
```shell | ||
python attestation.py cert -f show -m fido21 | ||
``` | ||
```shell | ||
# Example Output | ||
info: Showing an existing attestation certificate | ||
info: Loading settings file settings.ini | ||
info: Public certificate authority serial number: 385004152696321157272772190328151754561352515268 | ||
info: Public certificate authority SHA256 fingerprint: 9e8b43d2688663e9937c490bfa0ad4e59cc086d5e96e547f1c1f7ca27e977972 | ||
info: Public attestation certificate serial number: 723321508150486599877570106078221356789683409469 | ||
info: Public attestation certificate SHA256 fingerprint: 1c104b3380b028b703f2ab2cc841bfebb966d792f218aa2bb56bd81e88599842 | ||
info: Public attestation certificate (574 bytes): <certificate> | ||
info: Private attestation key (32 bytes): <private key> | ||
info: AAGUID: ad7f2c9e-94e4-48e8-98d8-e8d288c769f5 | ||
info: Applet installation parameter (contains CBOR configuration map with private attestation key 32 bytes): <monstrous hex string> | ||
``` | ||
Copy the params value | ||
- Install the applet with the "Applet installation parameter" for the install's --params switch. It will most likely complain about an invalid TLV. | ||
```shell | ||
--install FIDO2.cap --params <monstrous-hex-string> | ||
``` | ||
- Load the attestation certificate | ||
```shell | ||
python attestation.py cert upload -m fido21 | ||
``` | ||
|
||
## Apps with additional setup | ||
### [SmartPGP](https://github.com/github-af/SmartPGP) | ||
This one comes in two flavors: default and large. Do yourself a favor and stick to default--unless you want really large, insecure RSA keys. | ||
|
||
The SmartPGP applet is configured with the following default values: | ||
- Admin PIN is 12345678; | ||
- User PIN is 123456; | ||
- No PUK (a.k.a. resetting code) is defined; | ||
- RSA 2048 bits for PGP keys; | ||
- NIST P-256 for the secure messaging key. | ||
|
||
### Android | ||
Checkout these [videos on using this app](https://github.com/github-af/SmartPGP/tree/master/videos) with [OpenKeychain](https://www.openkeychain.org/). | ||
|
||
### PC | ||
Checkout [aegis](https://gist.github.com/ageis)' [guide](https://gist.github.com/ageis/14adc308087859e199912b4c79c4aaa4). |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would you consider really large keys insecure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I understood it, the key difference wasn't larger keys; it was larger RSA keys. RSA is insecure. Yes, you can use larger keys to cope--then you're paying twice: once for more resources on the app and again for every key. Doesn't it make more sense to use a modern algorithm?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless you have a good reason not to, I would advise new key pairs to use elliptic curves instead of RSA. Ideally, the Edwards curve - but that one is not yet supported in hardware so the next best thing are the NIST-P curves. Also see https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-57pt1r4.pdf#page=67 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, but it's not like RSA with large-enough keys is insecure. EC is more efficient, requiring smaller keys and less computation, but claiming RSA4096 is "insecure" is simply false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, my statement was incorrect--it should have been a blanket statement about RSA. Thanks for catching that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I would still disagree that RSA is inherently insecure if used with appropriate key lengths, but I can see that I'm stepping in a minefield (and it's not like I wouldn't recommend EC myself, for the improved efficiency alone) ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imho "security" of a modern crypto system without any obvious flaws (disregarding quantum computing) like RSA or ECC is a function of key length, i.e time it takes bruteforce that key. EC is more efficient - it takes longer to crack a key with the same amount of bits as RSA. But yea, RSA is not inherently insecure - it just recommends very long keys (>2048) nowadays, which makes it kind of cumbersome to run on embedded hardware and still be protected against a highly motivated attacker. Also see https://www.keylength.com/ for an interactive comparison.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well then, I take it all back. Sorry for all the confusion.