Tuesday 25 September 2012

ColdFusion IceBreaker #7 : Unprotect your protected PDF through CF

Protecting your PDF with a password is a common everyday use case .
Using ColdFusion this can be done in a single easy step.

But sometimes we need to programmatically de-crypt/un-protect the same PDF.
There can be various ways of accomplishing this feat,but again ColdFusion makes it easy and a single step process

The trick to get to the treat ( the un-protected pdf , in this case ) is to use cfpdf tag and set your encyption to none using the "encrypt" attribute. You can do so only if you have the owner password , as technically only the document owner should have the permissions to change the security settings of a document

So assuming your PDF is called MyPdf.pdf with a owner password of "changesettings",use the below mentioned code to remove password protection from your PDF

<cfpdf action="protect" source="MyPdf.pdf" destination="MyUnsafePdf.pdf" 
password="changesettings" encrypt="none" />

Open MyUnsafePdf.pdf and you have your pdf without password protection


Wednesday 19 September 2012

Convert your pfx keystore to jks keystore

Many times we need to convert our PKCS12 keystore/digital signature/digital id file to JKS files.

There are various many ways of doing it . Most blogs talk about how OpenSSL would help you do it and other go on about new tools.But its all within java keytool's capabilities.

Its actually as simple as what I quote below.

Goto your <JAVA_HOME>/jre/bin


keytool -importkeystore -srckeystore MyPfx.pfx -srcstoretype pkcs12 -srcstorepass mysrcpassword  -destkeystore exportfrompfx.jks -deststoretype jks -deststorepass mydestpassword


This process will create a new jks file and call it exportfrompfx.jks

All the certificates with their aliases will be exported from MyPfx.pfx to exportfrompfx.jks

Use the following command then to verify your new keystore:

keytool -list -storetype jks -keystore exportfrompfx.jks -v


To selectively add each certificate use its alias.

Get the alias using the above mentioned list command

keytool -list -storetype jks -keystore exportfrompfx.jks -v


Use keytool to import that alias into your JKS keystore

keytool -importkeystore -srckeystore MyPfx.pfx -srcstoretype pkcs12 -srcstorepass mysrcpassword -srcalias alias -destkeystore exportfrompfx.jks -deststoretype jks -deststorepass mydestpassword -destalias destalias



Thursday 13 September 2012

Burst of Colour

IMG_8004-1IMG_8014-1IMG_8018-1IMG_8025-1IMG_8028-1

Burst of Colour, a set on Flickr.

Clicked at the annual flower show held every August in Bangalore, these flowers bring to life the delight experienced by the 1.2 lakh people who visited this flower show every day.You can also buy various varieties of plants.

Wednesday 12 September 2012

Monsooned

Monsooned by Viny N
Monsooned, a photo by Viny N on Flickr.

A pool full of lotus leaves gets monsooned in wayanad..water..both above and below the leaves..looking absolutely lovely