At the moment, I’m working on some Chrome Extensions.
I struggeled around, which type of Extension I should create. My main problem is, that I want to create an Extensions, which is delivered with our Web Application.
This brings me to the point, that some configurations have to be set on Runtime. But how should I do that, if the CRX-File was already packed.
So I decided to implement the Algorithmns I found in Languages like Ruby or Python in Java. Therfore I had to fight with extracting the Public Key from the PEM File.
First Steps I had done was, that I converted the PEM File with „openssl“ to a DER File. With some SUN specific Classes, I could extract the Parameters I have need to create a Public Key.
Later I changed it to use Bouncy Castle, which allows to extract them, with out using Classes which are JRE specific. (with my normal way, it would not work on IBMs JRE for Example)
Gist, what has to be done, if you have the Public- and Private Key.
The complete Project can be found on my github Repository manzke @ github
The easiest way is to:
– zip all your content (go into your WebApp-Directory and create a zip)
– lets create the PEM File for it (with for example chrome://extensions and choose „Load unpacked“ or „Pack Extension“)
– call „java de.devsurf.chrome.extensions.CrxWriter yourapp.crx yourapp.zip yourapp.pem“ (with „crxmake-console“ you have to transform your pem first with „openssl pkcs8 -topk8 -nocrypt -in key.pem -inform PEM -out key.der -outform DER“)
Have fun. I will extend the Project with some Examples how to automatically generate a PEM File, JAX-RS Extension to pack it and create the CRX at runtime.