Saturday, September 21, 2013

Some Pictures I took this Weekend...

Sun at sunset. Very beautiful picture I took when I was performing my usual jogging. It looks like Goku's Spirit Bomb... :]

Nice view over Cergy's lake/parc. The small island in the front is called the "Astronomic Island". At night, a green laser beam is directed toward that island from a tower (or an axe to be more precise) standing just behind me. Notice also the small pyramid at the left :-) This place is perfect to breathe some fresh air and practise some sports activity. The whole way from the axe until the island, going through the red bridge is called "Axe majeur"

I was lucky enough to take a picture of this airship while it was flying around. The photo is not very clear as to be able to say whether it's really an airship or an UFO :)

Monday, August 5, 2013

Let's have some Fight!! :-)


Official trailer of Street Fighter 4 - I never get tired of watching it :-) This is definitely the best fighting video game ever!!

Saturday, July 13, 2013

Some Words about One Piece



As the banner of my blog suggests, I am a huge fan of One Piece. For those of you who don't know this universe, learn that this is a great anime that relates the adventures of a young pirate crew (Mugiwara's) that travel the oceans searching for the great treasure left by the one and only late King of pirates, Gol D Roger. This man, respected by all his fellows obtained all what this World has to offer: wealth, glory and power. Roger, when pronouncing his last words during his execution, passed on his will to a new generation of pirates by setting up a challenge for those who have enough courage to set sail, travel the seas and fight for their dreams, to find the One Piece and become the next Pirate King.

The straw hat (picture above) has a very special meaning in One Piece. It's an object who belonged to Roger. He entrusted it the red haired Shanks, a brillant member of his crew, who, in turn, bet on the new generation by giving it to Luffy, a young boy whose dream is to become the next Pirate King. For Luffy, the straw hat is a precious gift and a treasure from the man who lost his left arm to save his life when he was a kid and taught him that pirates do value friendship and morals. Luffy made a promise to Shanks to give him the hat back only when he becomes the new Pirate King. To Luffy, the straw hat represents his ambition and his dream.

With Luffy, we've lived the adventure for many years now. We hope this continues forever... Long Live One Piece!! :-)

Monday, March 11, 2013

Importance of Coding


Learning how to write good computer code becomes more and more important today with the explosive growth of Internet and IT technologies. In the near future, the world will experience a huge demand to very skilled computer engineers to take the lead and keep on innovating and provide people with improved software services.
To this end, there is no better way than teaching our children from a very early age how to talk and communicate with a computer, and make them feel this passion and see how funny this can be. Code.org is a community that have started recently a campaign in order to sensitize about how important teaching computer coding at schools can be. This initiative has been promoted and supported by today's IT advocates who made this very nice video footage.



You feel concerned, feel free to join the cause ;-)

Sunday, February 10, 2013

Scrum Simulator (Simulateur de mêlée)

There are two reasons that make this project one of the funniest I have worked on: first because it allies technology and sports (rugby), and second because I didn't know a damn thing about rugby which meant that I needed to watch some matches in order to better understand the game's principles and rules and be aware of all the risks and the beating that rugby men had to go through in every match :)

One of the most violent and physical maneuver of this game is the scrum. This maneuver involves 8 rugbymen of each team who enter in collision in order to take control of the ball. Each team has 3 men in the first line, 4 in the second and one last man at the back. The 3 located in the first position are the most vulnerable because they receive the full impact and risk severe injuries if the scrum is taken down.

The scrum simulator was designed to better understand and study the reasons why the scrum may collapse, analyze precisely how rugbymen are behaving during the scrum and help them improve their technique in order to avoid bad scenarios and reduce the risk of injury.

The final system looks much like a spider :) It's a six axis robot solid enough to resist a charge of few tones. It can move and rotate in all directions, and with some computer software, it becomes quiet intelligent and a good partner during training.

Following two videos: the first shows how the simulator is actually used for training, and the second is more about creating the buzz.




Saturday, February 9, 2013

Sign your PassBook Passes with OpenSSL!!


I've been trying recently to integrate Apple's Passbook to some of my iOS apps. Passbook is a service introduced by Apple in iOS 6. It works much like a pocket wallet in which customers can put their airport or theater tickets, loyalty cards, coupons and many more. It allows customers to undertake action in the real world by presenting the electronic versions of their loyalty cards, coupons, tickets, etc... to the merchant in store. This is part of Apple's strategy in promoting and fostering mobile payments which still can not find a place in the heart of customers.

Apple has defined the format of Passbook passes and made them as generic as possible in order to give the liberty for businesses to customize the design and the information included in the pass depending on their needs. Passbook also comes with some nice features like the geolocated alerts that are displayed in the lock screen when a user is around a shop or a place where the pass can be redeemed. Unlocking the screen will then show Passbook and invite the customer to use the pass. Passes do also require the URL of a web service allowing business to remotely update them. Apple also made sure passes are provisioned and distributed easily, either by email, push notifications, iCloud or in-app by connecting to the remote web service that manages them.

When it comes to security, Passbook passes are zip archive packages containing a bunch of data files (pass resources) and a PKCS#7 signature, much known as S/MIME, generated by signing a manifest file using a certificate provided by Apple. To get the certificate, developers need of course to subscribe to one of Apple's developer programs. Signing passes is necessary to be able to discard those signed by unauthorized issuers.

Apple provides a sample OS/X app named "signpass" to sign passes on Mac. The same code however can not be utilized on iOS because the Cryptographic Message Syntax API does not seem to be implemented yet. Technically, passes shall not be signed on iOS for security reasons, because this requires the signing certificate to be loaded into the application. Even it is technically possible to securely provision the app with the certificate, assuming that it has been downloaded from a server using SSL and securely stored in the device using the iOS keychain service, this should be avoided as much as possible because the deployment of passes should be centralized.

Personally I had to do this on iOS in order to not be dependent on a specific server, especially when presenting demos. It is not always possible in this kind of situations to have access to the remote server. I searched around on the internet and could not find a sample code that shows how to generate S/MIME signature on iOS, while many people were suggesting using OpenSSL. I had then no choice but to use OpenSSL.

The OpenSSL library can be built on iOS. Here you can find a script to build it with the latests iOS SDK => https://github.com/x2on/OpenSSL-for-iPhone . You'll probably have to slightly tweak the script by setting the adequate SDK version.

Once OpenSSL built, you can link it with your iOS app and use the following code to generate the PKCS#7 signature.



 #include <openssl/pem.h>  
 #include <openssl/pkcs12.h>  
 #include <openssl/pkcs7.h>  
 #include <openssl/err.h>

+(BOOL)signManifest:(NSData *)manifest toPath:(NSString *)signaturePath withPKCS12FilePath:(NSString *)pkcs12 andAdditionalCACertPath:(NSString *)intermediateCertPath {  
      NSLog(@"%s", __FUNCTION__);  
      BOOL result = NO;  
      FILE *fp;  
      BIO *in = NULL, *out = NULL;  
      PKCS12 *p12;  
      X509 *scert = NULL, *caCert = NULL;  
      STACK_OF(X509) *ca = NULL;  
      EVP_PKEY *skey = NULL;  
      PKCS7 *p7 = NULL;  

      /* For simple S/MIME signing use PKCS7_DETACHED.  
       * On OpenSSL 0.9.9 only:  
       * for streaming detached set PKCS7_DETACHED|PKCS7_STREAM  
       * for streaming non-detached set PKCS7_STREAM  
       */  
      int flags = PKCS7_DETACHED | PKCS7_BINARY;  
      OpenSSL_add_all_algorithms();  
      ERR_load_crypto_strings();

      /* Read in signer certificate and private key */  
      if (!(fp = fopen([pkcs12 UTF8String], "rb"))) {  
           NSLog(@"%s Error opening file %@", __FUNCTION__, pkcs12);  
           goto end;  
      }  
      p12 = d2i_PKCS12_fp(fp, NULL);  
      fclose (fp);  
      if (!p12) {  
        NSLog(@"%s Error reading PKCS#12 file", __FUNCTION__);  
        ERR_print_errors_fp(stderr);  
        goto end;  
      }
  
      if (!PKCS12_parse(p12, "", &skey, &scert, &ca)) {  
        NSLog(@"%s Error parsing PKCS#12 file", __FUNCTION__);  
        ERR_print_errors_fp(stderr);  
        goto end;  
      }  
      PKCS12_free(p12);  
         if (!scert || !skey)  
              goto end;  

   /* Read intermediate CA root certificates */  
   if (!(fp = fopen([intermediateCertPath UTF8String], "rb"))) {  
           NSLog(@"%s Error opening file %@", __FUNCTION__, intermediateCertPath);  
     goto end;  
   }  
   caCert = d2i_X509_fp(fp, NULL);  
   fclose (fp);  
   if (!caCert) {  
     NSLog(@"%s Error reading X509 Certificate file", __FUNCTION__);  
     ERR_print_errors_fp(stderr);  
     goto end;  
   }

   //Add the intermediate CA certificate to the signing stack  
   if (ca == NULL) {  
     ca = sk_X509_new_null();  
   }  
   sk_X509_push(ca, caCert);

      /* Open content being signed */  
      in = BIO_new_mem_buf((void *)[manifest bytes], [manifest length]);  
      if (!in)  
           goto end;

      /* Sign content */  
      p7 = PKCS7_sign(scert, skey, ca, in, flags);  
      if (!p7)  
           goto end;  
     
      //create a file handle to where the signature will be saved
      out = BIO_new_file([signaturePath UTF8String], "w");  
      if (!out)  
           goto end;  
      //if (!(flags & PKCS7_STREAM))  
      //     BIO_reset(in);  
      /* Write out S/MIME message */  
      if (!i2d_PKCS7_bio(out, p7))  
           goto end;

      result = YES;  
 end:  
      if (result == NO)  
   {  
           NSLog(@"%s Error Signing Data", __FUNCTION__);  
           ERR_print_errors_fp(stderr);  
   }  
   if (ca) {  
     sk_X509_free(ca);  
   }  
      if (p7)  
           PKCS7_free(p7);  
      if (scert)  
           X509_free(scert);  
      if (skey)  
           EVP_PKEY_free(skey);  
      if (in)  
           BIO_free(in);  
      if (out)  
           BIO_free(out);  
   return result;  
 }  

This is quite pure C code, except some text string and buffers that have been wrapped with some Objective-C classes NSString & NSData. Those can easily be replaced with char* arrays and you get a pure C code.

Hope this helps :-)

Thursday, January 31, 2013


Street Fighter II Music played at the Video Games Live, Paris 2010. The video is featuring Guile, Ryo and Ken's theme songs. Enjoy!! :]