Tuesday, October 06, 2009

How to validate a Mixi.jp signed OpenSocial request on App Engine

I know nothing about security, but had to validate a signed request and this experimentally seems to work.

Get the certificate from here:
http://developer.mixi.co.jp/appli/pc/lets_enjoy_making_mixiapp/require_servers

It is a long base64-encoded string that starts with -----BEGIN CERTIFICATE-----. Copy and paste it to base64 decoder. Store binary file "DecodedBase64.bin".

Run this command. This comes preinstalled on Mac Leopard.

openssl x509 -in DecodedBase64.bin -inform DER -noout -text

Copy and paste everything the hex values "Modulus (1024 bit):" to a text editor. Replace ":" and " " with "". Add \ to the end of each line. Now with this, you can use the instructions here to continue (the code after "which has been parsed, converted to hex value" on that page). Remember to put 0x in the beginning.