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

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

Issue 596083002: Update cryptotoken to 0.8.63 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove a deprecated line Created 6 years, 3 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
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
43 /** Perform enrollment 37 /** Perform enrollment
44 * @param {ArrayBuffer|Uint8Array} challenge Enrollment challenge 38 * @param {ArrayBuffer|Uint8Array} challenge Enrollment challenge
45 * @param {ArrayBuffer|Uint8Array} appIdHash Hashed application id 39 * @param {ArrayBuffer|Uint8Array} appIdHash Hashed application id
46 * @param {function(...)} cb Result callback 40 * @param {function(...)} cb Result callback
41 * @param {boolean=} opt_individualAttestation Request the individual
42 * attestation cert rather than the batch one.
47 */ 43 */
48 Gnubby.prototype.enroll = function(challenge, appIdHash, cb) { 44 Gnubby.prototype.enroll = function(challenge, appIdHash, cb,
45 opt_individualAttestation) {
46 var p1 = Gnubby.P1_TUP_REQUIRED | Gnubby.P1_TUP_CONSUME;
47 if (opt_individualAttestation) {
48 p1 |= Gnubby.P1_INDIVIDUAL_KEY;
49 }
49 var apdu = new Uint8Array( 50 var apdu = new Uint8Array(
50 [0x00, 51 [0x00,
51 Gnubby.U2F_ENROLL, 52 Gnubby.U2F_ENROLL,
52 Gnubby.P1_TUP_REQUIRED | Gnubby.P1_TUP_CONSUME, 53 p1,
53 0x00, 0x00, 0x00, 54 0x00, 0x00, 0x00,
54 challenge.length + appIdHash.length]); 55 challenge.length + appIdHash.length]);
55 if (B64_encode(appIdHash) == Gnubby.GOOGLE_CORP_APP_ID_HASH_)
56 apdu[2] |= Gnubby.P1_INDIVIDUAL_KEY;
57 var u8 = new Uint8Array(apdu.length + challenge.length + 56 var u8 = new Uint8Array(apdu.length + challenge.length +
58 appIdHash.length + 2); 57 appIdHash.length + 2);
59 for (var i = 0; i < apdu.length; ++i) u8[i] = apdu[i]; 58 for (var i = 0; i < apdu.length; ++i) u8[i] = apdu[i];
60 for (var i = 0; i < challenge.length; ++i) u8[i + apdu.length] = 59 for (var i = 0; i < challenge.length; ++i) u8[i + apdu.length] =
61 challenge[i]; 60 challenge[i];
62 for (var i = 0; i < appIdHash.length; ++i) { 61 for (var i = 0; i < appIdHash.length; ++i) {
63 u8[i + apdu.length + challenge.length] = appIdHash[i]; 62 u8[i + apdu.length + challenge.length] = appIdHash[i];
64 } 63 }
65 this.apduReply(u8.buffer, cb); 64 this.apduReply(u8.buffer, cb);
66 }; 65 };
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 self.version_ = v1.buffer; 140 self.version_ = v1.buffer;
142 cb(-GnubbyDevice.OK, v1.buffer); 141 cb(-GnubbyDevice.OK, v1.buffer);
143 } else { 142 } else {
144 if (!rc) { 143 if (!rc) {
145 self.version_ = data; 144 self.version_ = data;
146 } 145 }
147 cb(rc, data); 146 cb(rc, data);
148 } 147 }
149 }); 148 });
150 }; 149 };
OLDNEW
« no previous file with comments | « chrome/browser/resources/cryptotoken/enroller.js ('k') | chrome/browser/resources/cryptotoken/googlecorpindividualattest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698