Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Side by Side Diff: chrome/browser/resources/cryptotoken/gnubby-u2f.js

Issue 461403003: Add VID/PID pairs for known U2F devices. Interrim explicit listing until HID (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/cryptotoken/manifest.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview Gnubby methods related to U2F support. 6 * @fileoverview Gnubby methods related to U2F support.
7 */ 7 */
8 'use strict'; 8 'use strict';
9 9
10 // Commands and flags of the Gnubby applet 10 // Commands and flags of the Gnubby applet
(...skipping 16 matching lines...) Expand all
27 Gnubby.P1_TUP_TESTONLY = 0x04; 27 Gnubby.P1_TUP_TESTONLY = 0x04;
28 /** Attest with device key */ 28 /** Attest with device key */
29 Gnubby.P1_INDIVIDUAL_KEY = 0x80; 29 Gnubby.P1_INDIVIDUAL_KEY = 0x80;
30 30
31 // Version values 31 // Version values
32 /** V1 of the applet. */ 32 /** V1 of the applet. */
33 Gnubby.U2F_V1 = 'U2F_V1'; 33 Gnubby.U2F_V1 = 'U2F_V1';
34 /** V2 of the applet. */ 34 /** V2 of the applet. */
35 Gnubby.U2F_V2 = 'U2F_V2'; 35 Gnubby.U2F_V2 = 'U2F_V2';
36 36
37 /**
38 * Google corporate appId hash
39 * @private
40 */
41 Gnubby.GOOGLE_CORP_APP_ID_HASH_ = 'ZEZHL99u7Xvzwzcg8jZnbDbhtF6-BIXbiaPN_dJL1p8';
42
37 /** Perform enrollment 43 /** Perform enrollment
38 * @param {ArrayBuffer|Uint8Array} challenge Enrollment challenge 44 * @param {ArrayBuffer|Uint8Array} challenge Enrollment challenge
39 * @param {ArrayBuffer|Uint8Array} appIdHash Hashed application id 45 * @param {ArrayBuffer|Uint8Array} appIdHash Hashed application id
40 * @param {function(...)} cb Result callback 46 * @param {function(...)} cb Result callback
41 */ 47 */
42 Gnubby.prototype.enroll = function(challenge, appIdHash, cb) { 48 Gnubby.prototype.enroll = function(challenge, appIdHash, cb) {
43 var apdu = new Uint8Array( 49 var apdu = new Uint8Array(
44 [0x00, 50 [0x00,
45 Gnubby.U2F_ENROLL, 51 Gnubby.U2F_ENROLL,
46 Gnubby.P1_TUP_REQUIRED | Gnubby.P1_TUP_CONSUME | 52 Gnubby.P1_TUP_REQUIRED | Gnubby.P1_TUP_CONSUME,
47 Gnubby.P1_INDIVIDUAL_KEY,
48 0x00, 0x00, 0x00, 53 0x00, 0x00, 0x00,
49 challenge.length + appIdHash.length]); 54 challenge.length + appIdHash.length]);
50 // TODO: only use P1_INDIVIDUAL_KEY for corp appIdHashes. 55 if (B64_encode(appIdHash) == Gnubby.GOOGLE_CORP_APP_ID_HASH_)
56 apdu[2] |= Gnubby.P1_INDIVIDUAL_KEY;
51 var u8 = new Uint8Array(apdu.length + challenge.length + 57 var u8 = new Uint8Array(apdu.length + challenge.length +
52 appIdHash.length + 2); 58 appIdHash.length + 2);
53 for (var i = 0; i < apdu.length; ++i) u8[i] = apdu[i]; 59 for (var i = 0; i < apdu.length; ++i) u8[i] = apdu[i];
54 for (var i = 0; i < challenge.length; ++i) u8[i + apdu.length] = 60 for (var i = 0; i < challenge.length; ++i) u8[i + apdu.length] =
55 challenge[i]; 61 challenge[i];
56 for (var i = 0; i < appIdHash.length; ++i) { 62 for (var i = 0; i < appIdHash.length; ++i) {
57 u8[i + apdu.length + challenge.length] = appIdHash[i]; 63 u8[i + apdu.length + challenge.length] = appIdHash[i];
58 } 64 }
59 this.apduReply(u8.buffer, cb); 65 this.apduReply(u8.buffer, cb);
60 }; 66 };
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 self.version_ = v1.buffer; 141 self.version_ = v1.buffer;
136 cb(-GnubbyDevice.OK, v1.buffer); 142 cb(-GnubbyDevice.OK, v1.buffer);
137 } else { 143 } else {
138 if (!rc) { 144 if (!rc) {
139 self.version_ = data; 145 self.version_ = data;
140 } 146 }
141 cb(rc, data); 147 cb(rc, data);
142 } 148 }
143 }); 149 });
144 }; 150 };
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/cryptotoken/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698