Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How I can programatically get the chrome extension ID from a crx file?

I compile the extension using the --pack-extension switch:

C:\Users\APOL0\AppData\Local\Google\Chrome\Application>chrome.exe --pack-extension="D:\MyExt"

Everything works fine: chrome generates Myext.crx and Myext.pem but I don't know how I can get extension ID for automatic installation using Windows' registry.

How can I get this ID without using "manual verification", ie. programatically?

like image 452
James Avatar asked Aug 31 '25 16:08

James


2 Answers

Edit May 14, 2018: Added clarification and link to 3rd party tool.

There is no official supported method (at time of writing) to programmatically get the extension ID from a CRX without manually interacting with Chrome. (See official method below)

Unofficial Method

The only programmatic method I've found any reference to online is on this SO answer. The author of the answer later posted a link to a ChromeIdGenerator tool they wrote to accomplish this. The tool is based on how Chrome calculated its extension IDs at that point. Full disclosure: I have not tested the tool to ensure its accuracy, it is simply the only tool I've found to accomplish what you're asking.

Official Method (manual)

If you open up your Chrome Extensions manager page, you can drag and drop your Myext.crx onto the page (you must be in "Developer Mode") and it will load your extension, showing you the new extension id.

like image 155
John Woodruff Avatar answered Sep 02 '25 13:09

John Woodruff


update June 30, 2023:

The Unofficial Method, is still working:

basically:

  • from the public key:
    openssl pkey -in myext.pem -pubout > myext.pub
  • a base64 version of it is made
  • then the 32 first chars of its sha256 hash is extracted
  • finally each char (which is an hexa digit) is use as an index in ascii table:
    ex: 'f' => 15 => 108 => 'p'
like image 37
chtimi59 Avatar answered Sep 02 '25 12:09

chtimi59