Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This <a href="https://github.com/Constellation/crxmake/blob/master/lib/crxmake.rb" rel="nofollow">ruby code</a> was helpful.</p> <p>Your public key must be in DER format, and unfortunately PHP's OpenSSL extension can't do that, so far as I can tell. I had to generate it from my private key at the command line:</p> <pre><code>openssl rsa -pubout -outform DER &lt; extension_private_key.pem &gt; extension_public_key.pub </code></pre> <p><strong>UPDATE</strong>: there is a PHP der2pem() function <a href="http://www.php.net/manual/en/ref.openssl.php#74188" rel="nofollow">available here</a>, thanks to tutuDajuju for pointing it out.</p> <p>Once that's done, building the .crx file is quite easy:</p> <pre><code># make a SHA1 signature using our private key $pk = openssl_pkey_get_private(file_get_contents('extension_private_key.pem')); openssl_sign(file_get_contents('extension.zip'), $signature, $pk, 'sha1'); openssl_free_key($pk); # decode the public key $key = base64_decode(file_get_contents('extension_public_key.pub')); # .crx package format: # # magic number char(4) # crx format ver byte(4) # pub key lenth byte(4) # signature length byte(4) # public key string # signature string # package contents, zipped string # # see http://code.google.com/chrome/extensions/crx.html # $fh = fopen('extension.crx', 'wb'); fwrite($fh, 'Cr24'); // extension file magic number fwrite($fh, pack('V', 2)); // crx format version fwrite($fh, pack('V', strlen($key))); // public key length fwrite($fh, pack('V', strlen($signature))); // signature length fwrite($fh, $key); // public key fwrite($fh, $signature); // signature fwrite($fh, file_get_contents('extension.zip')); // package contents, zipped fclose($fh); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload