Opened 6 years ago

Closed 2 weeks ago

#5894 closed enhancement (invalid)

Replace sha256.js and base64_encode() with Mozilla's internal equivalents

Reported by: gk Owned by: legind
Priority: Low Milestone:
Component: HTTPS Everywhere/EFF-HTTPS Everywhere Version:
Severity: Normal Keywords:
Cc: gk, Drugoy Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

To reduce code bloat and avoid JavaScript's bit shifting inefficiencies it would be good to replace sha256.js and base64_encode() in ssl-observatory.js with functionality provided by Mozilla itself. The former is quite easy using nsICryptoHash (see the the example "Computing the Hash of a String" on https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsICryptoHash). The latter is not working directly using btoa(). The reason is that |derData| is an array but btoa() needs a string as argument. But one can construct a string out of the array and use that in turn as input. The relevant code snipped would be something like

  let result = "";
  for (let j = 0, dataLength = derData.length; j < dataLength; ++j) {
    result += String.fromCharCode(derData[j]);
  }
  base64Certs.push(btoa(result));

I have implemented both approaches in JonDoFox and they work as expected.

Child Tickets

TicketTypeStatusOwnerSummary
#5478defectclosedpdeUse internal module to work with SHA256

Change History (7)

comment:1 Changed 6 years ago by pde

Cc: Drugoy added
Priority: normalminor

This is a good idea, but it will have trouble making to the top of my HTTPS Everywhere todo list.  Tested pull requests are welcome.

comment:2 Changed 6 years ago by pde

geko's base64 change landed in 3.0development.5

comment:3 Changed 7 months ago by teor

Severity: Normal

Set all open tickets without a severity to "Normal"

comment:4 Changed 2 weeks ago by cypherpunks

Owner: changed from pde to legind
Status: newassigned

comment:5 Changed 2 weeks ago by legind

Resolution: invalid
Status: assignedclosed

This is for the old XPCOM extension and is deprecated.

comment:6 Changed 2 weeks ago by cypherpunks

Resolution: invalid
Status: closedreopened

Mark it as wontfix then.

comment:7 Changed 2 weeks ago by cypherpunks

Resolution: invalid
Status: reopenedclosed

I think it's still invalid since the request ask for something on a deprecated/no longer existent thing which is invalid according to Oxford Dictionary and Merriam-Webster.

Note: See TracTickets for help on using tickets.