Spring MVC : Date problem fix

Add this following code to resolve the date problem in your controller

     private void dateBinder(WebDataBinder binder) {
          // The date format to parse or output your dates
          SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
          // Create a new CustomDateEditor
          CustomDateEditor editor = new CustomDateEditor(dateFormat, true);
          // Register it as custom editor for the Date type
          binder.registerCustomEditor(Date.class, editor);


RSA encryption example

This an example of rsa encryption (Size is 2048)  using openssl tool. Output will be in base64 format, so that it can be shared easily.

Step 1: Generate the private key file

$ openssl genrsa -out private.pem 2048

Step 2: Extract the public key file

$ openssl rsa -in private.pem -out public.pem -outform PEM –pubout

Step 3 : Save your secret key in secret.txt

 Step 4: Encrypt the secret file

$ openssl rsautl -encrypt -inkey public.pem -pubin -in secret.txt –out secret.ssl

Step 5: Convert to base 64

$ openssl enc –base64 –in secret.ssl –out secret.ssl.enc