This ruby code was helpful.
Your public key must be in DER format, and unfortunately the PHP OpenSSL extension cannot do this, as far as I can tell. I had to generate it from my private key on the command line:
openssl rsa -pubout -outform DER < extension_private_key.pem > extension_public_key.pub
UPDATE : There is a PHP der2pem () function available here , thanks to tutuDajuju for specifying it.
After that, creating a .crx file is pretty simple:
# 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);
source share