Recently, while trying to install the cr-gpg Google Chrome Extension (blog post to come), I ran into a small problem trying to import the .crx file. This led me to find out what the .crx file type is, and how to extract it. As most of the posts on this blog are for rather advanced linux users, I’m going to try and make this more general and helpful for the general public.
TL;DR
The short answer: unzip
!
It’s a .zip file with an extra header containing the author’s public key and GPG signature. You may want to strip it if you’re repackaging it.
The file specification can be found on Google’s .crx Package Format page.
The Long Answer
Question: What is a CRX File?
Did you find a CRX file in your web browser’s “Downloads” folder on your computer and wonder what program should open it? Maybe you’ve been trying to install an unofficial Google Chrome Extension and got the message “Apps, extensions, and user scripts cannot be added from this website” when opening the .crx file.
Answer
A file with the CRX file extension is a Google Chrome Browser Extension Archive file.
According to a quick google search: CRX files might also be “Links Games Course” files (Although it comes up as a top result in Google, I couldn’t find any other info on this… I’m unsure if these are even a valid file type, or just google search spam?).
How To Open a CRX File
As you probably know, the easiest way to open any file is to double-click it and let your PC decide which default application should open the file. If no program opens the CRX file then you probably don’t have an application (ie: Google Chrome) installed that can view and/or edit CRX files.
Warning: If you are on Windows, beware when opening executable file formats received via email or downloaded from websites which you are not familiar with. See this List of Executable File Extensions for file extensions to avoid and why. (If you are on linux, be smart, be secure, and be happy! ^_^)
The CRX file type is primarily associated with the ‘Google Chrome’ web browser by Google. Any file with extension CRX is likely a plugin file or as it is more commonly known: a Google Chrome Extension file. These files are used to package a Google Chrome extension, and can be installed in Google Chrome to add extra features to the browser.
The Google Chrome browser uses CRX files to provide extend-ability in the browser program. A Google Chrome CRX file is really just a renamed ZIP file with an extra bunch of bytes in the header to verify the plugin’s origin (and validate the private key’s signature using the public key). This is all done for security purposes, as we would not want to run or install any browser plugin from a source that we do not trust.
In theory, any archive/compression program, like 7-Zip, TUGZip, unzip, MacZip (all free) OR Winzip/WinRAR (non-free), will open CRX files for extraction (expansion/decompression). CRX files may also be opened using any other archive tools you may be familiar with to view the contents of the packaged plugin/extension. However, depending on whether your tool can ignore the file header correctly, you may need to strip it first to convert to a zip, or use another tool.
If you find that an application on your computer does try to open the .CRX file but it’s the wrong program or if you would rather have another installed program open CRX files, you might need to Change the Default Program for this file extension. (If you’re on a Mac, please see this 4 step tutorial on how to change the default application for a filetype).
How To Convert a CRX File to a ZIP file
As of this writing, there is no way to open the CRX file in its default program (Google Chrome) and choose to save the open file as another file format. However, you may want to try 7-zip to extract it, modify to your liking, and then repackage it as a .ZIP.
There is one basic way to attempt to convert a CRX file to a ZIP file: strip the extra header!
Important: You cannot usually change a file extension (like the CRX file extension) to one that your computer recognizes and expect the newly renamed file to be usable. An actual file format conversion using one of the methods described above must take place in most cases.
To do this job, we’re going to have to resort to some basic unix commands: dd
and tail
To strip the header, you’ll need to know how long it is first. Luckily, InfoZIP‘s unzip
utility can tell us how long it is (tested on Ubuntu and CentOS with unzip versions 6.00 and 5.52 respectively):
# Get unzip if we don't have it
[ -z "$(which unzip)" -a -n "$(which apt-get)" ] && sudo apt-get -y install unzip
[ -z "$(which unzip)" -a -n "$(which yum)" ] && sudo yum -y install unzip
unzip -l file.crx
Sample output:
Archive: file.crx
warning [file.crx]: 306 extra bytes at beginning or within zipfile
(attempting to process anyway)
Length Date Time Name
--------- ---------- ----- ----
175 1980-00-00 00:00 background.html
5047 1980-00-00 00:00 background.js
0 1980-00-00 00:00 binaries/
19860 1980-00-00 00:00 content_script.js
58 1980-00-00 00:00 custom.css
4224 1980-00-00 00:00 general.html
4400 1980-00-00 00:00 icon.png
0 1980-00-00 00:00 images/
93868 1980-00-00 00:00 jquery-1.7.1.min.js
32709 1980-00-00 00:00 jquery-ui-1.8.11.thinkst.css
370776 1980-00-00 00:00 jquery-ui-1.8.13.custom.js
11674 1980-00-00 00:00 jquery-ui-1.8.13.custom.min.js
811 1980-00-00 00:00 jquery-ui-content.hack.js
2736 1980-00-00 00:00 jquery.client.js
11688 1980-00-00 00:00 jquery.ui.widget.js
1273 1980-00-00 00:00 manifest.json
2523 1980-00-00 00:00 options.html
2206 1980-00-00 00:00 options.js
4462 1980-00-00 00:00 popup.html
2050 1980-00-00 00:00 popup.js
1776 1980-00-00 00:00 images/sprite_black2.png
1633 1980-00-00 00:00 images/verify.png
0 1980-00-00 00:00 binaries/Mac/
0 1980-00-00 00:00 binaries/Ubuntu/
0 1980-00-00 00:00 binaries/Windows/
45568 1980-00-00 00:00 binaries/Windows/libgpg-error-0.dll
235520 1980-00-00 00:00 binaries/Windows/libgpgme-11.dll
1027584 1980-00-00 00:00 binaries/Windows/npwebpgPlugin-v0.5.9.dll
2305852 1980-00-00 00:00 binaries/Ubuntu/npwebpgPlugin-v0.5.9_32.so
1768658 1980-00-00 00:00 binaries/Ubuntu/npwebpgPlugin-v0.5.9_64.so
0 1980-00-00 00:00 binaries/Mac/npwebpgPlugin-v0.5.9.plugin/
0 1980-00-00 00:00 binaries/Mac/npwebpgPlugin-v0.5.9.plugin/Contents/
2082 1980-00-00 00:00 binaries/Mac/npwebpgPlugin-v0.5.9.plugin/Contents/Info.plist
0 1980-00-00 00:00 binaries/Mac/npwebpgPlugin-v0.5.9.plugin/Contents/MacOS/
0 1980-00-00 00:00 binaries/Mac/npwebpgPlugin-v0.5.9.plugin/Contents/Resources/
0 1980-00-00 00:00 binaries/Mac/npwebpgPlugin-v0.5.9.plugin/Contents/Resources/English.lproj/
150 1980-00-00 00:00 binaries/Mac/npwebpgPlugin-v0.5.9.plugin/Contents/Resources/English.lproj/InfoPlist.strings
411 1980-00-00 00:00 binaries/Mac/npwebpgPlugin-v0.5.9.plugin/Contents/Resources/English.lproj/Localized.rsrc
3462932 1980-00-00 00:00 binaries/Mac/npwebpgPlugin-v0.5.9.plugin/Contents/MacOS/webpgPlugin
--------- -------
9422706 39 files
You should see the number of extra bytes output as:
warning [file.crx]: NNN extra bytes at beginning or within zipfile
Now all we need is to strip the extra bytes. There are two main ways to attempt to strip the extra header (and convert) the CRX file:
- Use dd (set skip=NNN bytes)
dd if=cr-gpg-0.8.3.crx of=/tmp/file.zip bs=1 skip=306
- Use tail (use -c +NNN+1 bytes. Ex: NNN=306 => use 307)
tail -c +NNN+1 file.crx > /tmp/file.zip
Dec 15 2012
About .CRX Files: What is a CRX file and how do I extract it
Recently, while trying to install the cr-gpg Google Chrome Extension (blog post to come), I ran into a small problem trying to import the .crx file. This led me to find out what the .crx file type is, and how to extract it. As most of the posts on this blog are for rather advanced linux users, I’m going to try and make this more general and helpful for the general public.
TL;DR
The short answer:
unzip
!It’s a .zip file with an extra header containing the author’s public key and GPG signature. You may want to strip it if you’re repackaging it.
The file specification can be found on Google’s .crx Package Format page.
The Long Answer
Question: What is a CRX File?
Did you find a CRX file in your web browser’s “Downloads” folder on your computer and wonder what program should open it? Maybe you’ve been trying to install an unofficial Google Chrome Extension and got the message “Apps, extensions, and user scripts cannot be added from this website” when opening the .crx file.
Answer
A file with the CRX file extension is a Google Chrome Browser Extension Archive file.
According to a quick google search: CRX files might also be “Links Games Course” files (Although it comes up as a top result in Google, I couldn’t find any other info on this… I’m unsure if these are even a valid file type, or just google search spam?).
How To Open a CRX File
As you probably know, the easiest way to open any file is to double-click it and let your PC decide which default application should open the file. If no program opens the CRX file then you probably don’t have an application (ie: Google Chrome) installed that can view and/or edit CRX files.
Warning: If you are on Windows, beware when opening executable file formats received via email or downloaded from websites which you are not familiar with. See this List of Executable File Extensions for file extensions to avoid and why. (If you are on linux, be smart, be secure, and be happy! ^_^)
The CRX file type is primarily associated with the ‘Google Chrome’ web browser by Google. Any file with extension CRX is likely a plugin file or as it is more commonly known: a Google Chrome Extension file. These files are used to package a Google Chrome extension, and can be installed in Google Chrome to add extra features to the browser.
The Google Chrome browser uses CRX files to provide extend-ability in the browser program. A Google Chrome CRX file is really just a renamed ZIP file with an extra bunch of bytes in the header to verify the plugin’s origin (and validate the private key’s signature using the public key). This is all done for security purposes, as we would not want to run or install any browser plugin from a source that we do not trust.
In theory, any archive/compression program, like 7-Zip, TUGZip, unzip, MacZip (all free) OR Winzip/WinRAR (non-free), will open CRX files for extraction (expansion/decompression). CRX files may also be opened using any other archive tools you may be familiar with to view the contents of the packaged plugin/extension. However, depending on whether your tool can ignore the file header correctly, you may need to strip it first to convert to a zip, or use another tool.
If you find that an application on your computer does try to open the .CRX file but it’s the wrong program or if you would rather have another installed program open CRX files, you might need to Change the Default Program for this file extension. (If you’re on a Mac, please see this 4 step tutorial on how to change the default application for a filetype).
How To Convert a CRX File to a ZIP file
As of this writing, there is no way to open the CRX file in its default program (Google Chrome) and choose to save the open file as another file format. However, you may want to try 7-zip to extract it, modify to your liking, and then repackage it as a .ZIP.
There is one basic way to attempt to convert a CRX file to a ZIP file: strip the extra header!
Important: You cannot usually change a file extension (like the CRX file extension) to one that your computer recognizes and expect the newly renamed file to be usable. An actual file format conversion using one of the methods described above must take place in most cases.
To do this job, we’re going to have to resort to some basic unix commands:
dd
andtail
To strip the header, you’ll need to know how long it is first. Luckily, InfoZIP‘s
unzip
utility can tell us how long it is (tested on Ubuntu and CentOS with unzip versions 6.00 and 5.52 respectively):Sample output:
You should see the number of extra bytes output as:
Now all we need is to strip the extra bytes. There are two main ways to attempt to strip the extra header (and convert) the CRX file:
By Administrator • Software