Skip to content

Commit 41fe202

Browse files
onlykeyonlykey
authored andcommitted
readme
1 parent a0c75c2 commit 41fe202

2 files changed

Lines changed: 107 additions & 63 deletions

File tree

README.md

Lines changed: 106 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,91 @@
33

44
## About
55

6-
WebCrypt is a serverless Web App that integrates with [OnlyKey](https://crp.to/p/) and [keybase.io](https://keybase.io/) to provide PGP encryption everywhere on-the-go.
6+
WebCrypt is a serverless Web App that integrates with [OnlyKey](https://onlykey.io) and [keybase.io](https://keybase.io/) to provide PGP encryption everywhere on-the-go.
77

8-
Supports Google Chrome and Firefox!
8+
Supports Firefox, Google Chrome, Brave, and Edge (new) browsers!
99

10-
**Still in early development available for testing only.**
10+
Supports macOS, Windows, Linux, Chrome OS, and Android!
1111

12-
[Try it out here!](https://apps.crp.to/encrypt-test)
12+
[Try it out here!](https://apps.crp.to/encrypt)
1313

1414
## How it works
1515

16-
With Keybase user/key management is made easy and with OnlyKey private keys remain offline and protected. Private keys are not accessible to the browser or even the local computer. By using U2F as a secure communication channel the web application can send messages to OnlyKey that are decrypted and signed offline. This provides similar function to a token/smart card but no drivers or software required. All that is needed is a browser that supports U2F and an OnlyKey to send secure messages using Windows, Mac, Linux, Chromebook, and Android (with OnlyKey Android app [here](https://play.google.com/store/apps/details?id=to.crp.android.onlykeyu2f&hl=en_US)).
16+
With Keybase user/key management is made easy and with OnlyKey private keys remain securely offline. Private keys are not accessible to the browser or even the local computer. By using FIDO2 as a secure communication channel the web application can send messages to OnlyKey that are decrypted and signed offline. This provides similar function to a token/smart card but no drivers or software required. All that is needed is a browser that supports FIDO2 and an OnlyKey to send secure messages and files.
17+
18+
{% include callout.html content="**Step 1. Find a Keybase User -** The first step in sending a secure message or file is to identify who to send it to. Browse to [https://apps.crp.to/search](https://apps.crp.to/search) to use our custom Keybase search tool to search Keybase users by:<br>
19+
- Twitter, Github, Reddit, or Hackernews Usernames<br>
20+
- Web domains<br>
21+
- PGP fingerprint<br>
22+
- Or Automatically search for best match" type="default" %}
23+
24+
{% include image.html file="user-search.jpg" %}
25+
26+
{% include callout.html content="**Step 2. Send a user encrypted message or file -** Click the link in the search results to send the selected user encrypted message/file. You can also browse to [https://apps.crp.to/encrypt](https://apps.crp.to/encrypt) to send a secure message or browse to [https://apps.crp.to/encrypt-file](https://apps.crp.to/encrypt-file) to send a secure file if you already know the recipient. To encrypt files for yourself just use your Keybase username as the recipient. " type="default" %}
27+
28+
{% include image.html file="webcrypt1.png" %}
29+
30+
{% include callout.html content="**Step 3. Receive an encrypted message or file -** To decrypt a message or file browse to [https://apps.crp.to/decrypt](https://apps.crp.to/decrypt) or [https://apps.crp.to/decrypt-file](https://apps.crp.to/decrypt-file). You can also create a unique link which allows anyone, with or without an OnlyKey to send you and encrypted file. This may be used in places such as an email signature to receive secure messages. The format is:
31+
<br><br>
32+
Send me a secure message -
33+
[https://apps.crp.to/encrypt.html?type=e&recipients=YOURKEYBASEUSERNAME](https://apps.crp.to/encrypt.html?type=e&recipients=YOURKEYBASEUSERNAME)
34+
<br><br>
35+
Send me a secure file
36+
[https://apps.crp.to/encrypt-file.html?type=e&recipients=YOURKEYBASEUSERNAME](https://apps.crp.to/encrypt-file.html?type=e&recipients=YOURKEYBASEUSERNAME)
37+
38+
" type="default" %}
39+
40+
{% include image.html file="webcrypt2.png" %}
41+
42+
### See WebCrypt in action {#openpgp-action}
43+
44+
After configuring your OnlyKey following [these instructions](#generating-keys) you can browse to the [Webcrypt app](https://apps.crp.to/encrypt) to send secure messages.
45+
46+
- Enter a message to encrypt
47+
{% include image.html file="encrypted-message.jpg" %}
48+
49+
- Enter the shown challenge code on the OnlyKey (i.e. 1,5,2)
50+
{% include image.html file="encrypted-message2.jpg" %}
51+
52+
- Encrypted message shown, by clicking the button again it will be copied to clipboard
53+
{% include image.html file="encrypted-message3.jpg" %}
54+
{% include image.html file="encrypted-message4.jpg" %}
55+
56+
- Paste the message into any email or chat (Sending via Gmail shown)
57+
{% include image.html file="encrypted-message5.jpg" %}
58+
59+
- When the recipient receives the message (email or chat) they can paste it into Webcrypt app to decrypt
60+
{% include image.html file="encrypted-message6.jpg" %}
61+
62+
- Enter the shown challenge code on the OnlyKey (i.e. 2,2,1)
63+
{% include image.html file="encrypted-message7.jpg" %}
64+
65+
- Decrypted message shown, if the sender signed the message you will see the sender's name (i.e. t) and their key ID.
66+
{% include image.html file="encrypted-message8.jpg" %}
67+
68+
- By clicking the button again the message will be copied to clipboard
69+
{% include image.html file="encrypted-message9.jpg" %}
70+
71+
{% include note.html content="Messages sent via Webcrypt are never sent over the internet. The way it works is the necessary files are downloaded to your browser and all processing is done in your browser. Read more about [Webcrypt security here](https://docs.crp.to/webcrypt.html#security-goals)" %}
72+
73+
## Benefits
74+
75+
- This revolutionary approach makes PGP encryption easy and secure with OpenPGP keys securely stored on OnlyKey, not accessible to the app or to the browser. This is in contrast to for example PGP/GPG software, webmail (i.e. Protonmail), and smartphone apps.
76+
- Physical user presence is required to process secure messages/files. This is in contrast to Smart Cards which only require a PIN code that can be captured and replayed without physical user presence.
77+
- WebCrypt even allows Kebase user’s to receive secure messages and files from non-OnlyKey users. Anyone can use WebCrypt to send encrypted messages/files and can create a unique link to receive secure messages and files.
78+
- With WebCrypt’s Keybase integration its easy to find Keybase users and send secure messages/files with the click of a button - https://apps.crp.to/search.
79+
1780

1881
## Setup
1982

2083
**Before using this app you must follow these instructions to generate PGP keys and load them on OnlyKey:**
2184
- [Generate keys](https://docs.crp.to/usersguide.html#generating-keys) using Keybase
2285
- [Load keys](https://docs.crp.to/usersguide.html#loading-keys) onto OnlyKey
2386

24-
If using Firefox, U2F must be enabled by completing the following steps in your browser:
25-
26-
- Type about:config into the Firefox browser.
27-
- Search for “u2f”.
28-
- Double click on security.webauth.u2f to enable U2F support.
29-
3087
## Sending secure messages
3188

3289
To create encrypted PGP message just:
33-
- Browse to https://apps.crp.to/encrypt-test
90+
- Browse to https://apps.crp.to/encrypt
3491
- Enter the recipient's Keybase ID in the first box
3592
- Enter your Keybase ID (for the key you loaded onto OnlyKey) in the second box
3693
- Enter your secure message in the third box
@@ -46,7 +103,7 @@ The encrypted message will be displayed and you can paste it into an email, IM,
46103
## Receiving secure messages
47104

48105
To decrypt PGP message just:
49-
- Browse to https://apps.crp.to/decrypt-test
106+
- Browse to https://apps.crp.to/decrypt
50107
- Enter your Keybase ID (for the key you loaded onto OnlyKey) in the first box
51108
- Paste your encrypted PGP message in the second box
52109
- Click "Decrypt and Verify"
@@ -58,7 +115,9 @@ The decrypted message will be displayed. Read it and then close the browser tab
58115

59116
## Security Goals
60117

61-
**Empower the people**: Give people the ability to securely send and receive messages using any computer with no complicated software/drivers required and no worrying about compromise of user's private identity.
118+
**Make PGP easy**: Traditional PGP makes journalists angry, we think you shouldn't have to be technologically savvy to use PGP so we built WebCrypt.
119+
120+
**Empower the people**: Give people the ability to securely send and receive messages using any computer or Android device with no complicated software/drivers required and no worrying about compromise of user's private identity.
62121

63122
**Serverless**: All processing done via javascript in users own browser locally (no server to hack).
64123

@@ -70,17 +129,17 @@ The decrypted message will be displayed. Read it and then close the browser tab
70129

71130
**Open source & audit-able** - What you see is what you get this repository is a Github page hosted directly on Github.
72131

73-
Please, feel free to commit fixes!
132+
We are always working to make WebCrypt better, pull requests welcome!
74133

75134
## Protocol
76135

77-
The protocol outlined below utilizes existing communication channel via U2F. More information is available on U2F protocol [here](https://fidoalliance.org/specs/fido-u2f-v1.0-nfc-bt-amendment-20150514/fido-u2f-raw-message-formats.html).
136+
The protocol outlined below utilizes existing communication channel via FIDO2.
78137

79138
### Communication Channel Overview (Advanced)
80139

81-
U2F utilizes registration and authentication message types. To send data to the OnlyKey, messages are encoded in the Key Handle of the authentication message type. To receive data back, messages are encoded in the signature of the authentication response. This method provides a reliable form of communication that is supported anywhere U2F is supported including Chrome, Chromium, Opera, and Firefox (Quantum or w/plugin).
140+
FIDO2 utilizes registration and authentication message types. To send data to the OnlyKey, messages are encoded in the Key Handle of the authentication message type. To receive data back, messages are encoded in the signature of the authentication response. This method provides a reliable form of communication that is supported anywhere U2F is supported including Firefox, Chrome, Chromium, Opera, Brave, and Edge (new).
82141

83-
The outline below visualizes the use of onlykey-api.js and u2f-api.js to communicate via browser to OnlyKey over USB.
142+
The outline below visualizes the use of onlykey-api.js and FIDO2 to communicate via browser to OnlyKey over USB.
84143

85144
```
86145
┌──────────────┐ ┌─────────┐
@@ -91,23 +150,20 @@ INITIALIZE - SET TIME, SET APP PUBLIC NaCl KEY, GET ONLYKEY PUBLIC NaCl KEY, GET
91150
92151
1. Authentication Request Message:
93152
94-
Encode a *packet in U2F Key Handle field that contains current epoch time and application public key.
95-
┌──────────────────┬──────────────────┬──────────────────┐
96-
│ challenge │ appId │ Key Handle │
97-
│ random │ crp.to │ *packet │
98-
│ (32 bytes) │ (32 bytes) │ (64 bytes) │
99-
└──────────────────┴──────────────────┴──────────────────┘
153+
Encode a *packet in key handle field that contains current epoch time and application public key.
154+
┌──────────────────┬──────────────────┐
155+
│ challenge │ Key Handle │
156+
│ random │ *packet │
157+
└──────────────────┴──────────────────┘
100158
───────────────────────────────────────────────────────────────────────────▶
101159
102160
2. Authentication Response Message:
103161
104-
Decode a *packet with OnlyKey public key, OnlyKey firmware version, and unused space filled with hardware
105-
generated entropy (entropy not currently used but may be used for future secure key generation operations).
106-
┌──────────────────┬─────────────────┬──────────────────┐
107-
│ User Presence │ Counter │ Signature │
108-
│ │ │ *packet │
109-
│ (1 byte) │ (4 bytes) │ (64 bytes) │
110-
└──────────────────┴─────────────────┴──────────────────┘
162+
Decode a *packet with OnlyKey public key, OnlyKey firmware version.
163+
┌──────────────────┐
164+
│ Signature │
165+
│ *packet │
166+
└──────────────────┘
111167
◀───────────────────────────────────────────────────────────────────────────
112168
113169
DECRYPTION/SIGNING REQUEST - DECRYPT OR SIGN DATA USING RSA PRIVATE KEY
@@ -116,16 +172,15 @@ DECRYPTION/SIGNING REQUEST - DECRYPT OR SIGN DATA USING RSA PRIVATE KEY
116172
117173
First, generate ECDH shared secret from OnlyKey's provided public key and application
118174
generated public key. AES-GCM key is derived from SHA256 hash of shared secret (32 bytes). Encrypt and decrypt
119-
all future packets with this key and IV set to an incrementing counter.
120-
121-
Encode encrypted *packet in U2F Key Handle field one chunk at a time (64 bytes).
122-
Repeat for each chunk of data. Once finished sending data ping messages continue to be sent in
123-
order to get response or error codes.
124-
┌──────────────────┬──────────────────┬───────────────────┐
125-
│ challenge │ appId │ Key Handle │
126-
│ random │ crp.to │ *packet │
127-
│ (32 bytes) │ (32 bytes) │ (64 bytes) │
128-
└──────────────────┴──────────────────┴───────────────────┘
175+
all future packets with this key.
176+
177+
Encode encrypted *packet in key handle field one chunk at a time (Max size 255 bytes).
178+
Repeat for each chunk of data. Once finished sending data ping messages sent in
179+
order to get response or error messages.
180+
┌──────────────────┬──────────────────┐
181+
│ challenge │ Key Handle │
182+
│ random │ *packet │
183+
└──────────────────┴──────────────────┘
129184
───────────────────────────────────────────────────────────────────────────▶
130185
131186
2. Authentication Response Message:
@@ -137,26 +192,13 @@ that message. This ensures that user presence is required to sign / decrypt and
137192
applies to a specific plaintext, not a spoofed message. For increased security future versions may permit
138193
a longer challenge code.
139194
140-
While waiting for the challenge code to be entered a ping is used to check status. If no status is returned (TIMEOUT) the app polls for the response.
141-
142-
Error/status codes:
143-
- Error 0 ping reply, ack
144-
- Error 1 incorrect challenge code entered
145-
- Error 2 key type not set as signature/decrypt
146-
- Error 3 no key set in this slot
147-
- Error 4 invalid key, key check failed
148-
- Error 5 invalid data, or data does not match key
149-
- Error 6 no data ready
150-
- Error code type 5 (TIMEOUT), ping failed, correct challenge code entered
151-
152-
Once the challenge code is entered correctly, the decryption / signing is completed and the result is stored on the
153-
OnlyKey until polling occurs (After 5 seconds unretrieved messages are automatically wiped from OnlyKey).
154-
155-
┌──────────────────┬─────────────────┬────────────────────────┐
156-
│ User Presence │ Counter │ Signature │
157-
│ │ │ *packet │
158-
│ (1 byte) │ (4 bytes) │ (Variable Size) │
159-
└──────────────────┴─────────────────┴────────────────────────┘
195+
Once the challenge code is entered correctly, the decryption / signing is completed and the result is encrypted via AES-GCM and stored on the OnlyKey (After 25 seconds unretrieved messages are automatically wiped from OnlyKey).
196+
197+
┌────────────────────────┐
198+
│ Signature │
199+
│ *packet │
200+
│ (Variable Size) │
201+
└────────────────────────┘
160202
◀───────────────────────────────────────────────────────────────────────────
161203
162204
```
@@ -170,7 +212,7 @@ Copyright 2012 Yahoo! Inc. All rights reserved. Licensed under the BSD License.
170212
Thanks to Ron Garret for originally posting a serverless implementation of U2F here - https://github.com/rongarret/u2f-test
171213

172214
The MIT License (MIT)
173-
Copyright (c) 2017 CryptoTrust LLC.
215+
Copyright (c) 2019 CryptoTrust LLC.
174216

175217
Permission is hereby granted, free of charge, to any person obtaining
176218
a copy of this software and associated documentation files (the
@@ -202,8 +244,9 @@ The form and manner of this distribution makes it eligible for export under the
202244

203245
The following cryptographic software is included in this distribution:
204246

205-
"Fast Elliptic Curve Cryptography in plain javascript" - https://github.com/indutny/elliptic
206247
"RFC4880 Implementation in IcedCoffeeScript" - https://github.com/keybase/kbpgp
248+
"Port of TweetNaCl cryptographic library to JavaScript" - https://github.com/dchest/tweetnacl-js
249+
"A native implementation of TLS in Javascript and tools to write crypto-based and network-heavy webapps" - https://github.com/digitalbazaar/forge
207250

208251
For more information on export restrictions see: http://www.apache.org/licenses/exports/
209252

src/app.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ class Pgp2go {
282282
console.error(err);
283283
alert('An error occurred attempting to encrypt this file. Please be sure you have authenticated, and try again.');
284284
}
285+
button.classList.remove('working');
285286
}
286287
var buffer = kbpgp.Buffer.from(parsedfile);
287288
switch (window._status) {

0 commit comments

Comments
 (0)