Friday, June 19, 2015

Clean previous installation of windows files and folders

Start -> Accessories -> System -> Disk Clean up -> clean up previous installtions -> ok. 

Tuesday, June 9, 2015

How to install unrar and rar facilities in mac

1) Download unrar  utility from RARLab
2) extract it through tar -xvf 
3) go inside extracted rar folder 
4) sudo install -c -o $USER rar /usr/local/bin
5) sudo install -c -o $USER unrar /usr/local/bin
6) hit enter and it will ask you for password .
7) u can use unrar and rar utilities in mac.

Thursday, June 4, 2015

How to Load SSL certificate in trustStore

Here is the code >>


static public void doTrustToCertificates(String certPath, String keyPath) throws Exception {

   try{


         char[] password = "changeit".toCharArray();

         String alias = "isskey";


         KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType());

         keystore.load(null, password);


         CertificateFactory cf = CertificateFactory.getInstance("X.509");

          InputStream certstream = fullStream (certPath);

          Certificate certs = cf.generateCertificate(certstream);

          File keystoreFile = new File(keyPath);

           // Add the certificate

          keystore.setCertificateEntry(alias, certs);

          // Save the new keystore contents

           FileOutputStream out = new FileOutputStream(keystoreFile);

           keystore.store(out, password);

           out.close();



}catch(Exception ex)

{
          ex.printStackTrace();

}


}



private static InputStream fullStream ( String fname ) throws IOException {

                  FileInputStream fis = new FileInputStream(fname);

                  DataInputStream dis = new DataInputStream(fis);

                  byte[] bytes = new byte[dis.available()];

                  dis.readFully(bytes);

                  ByteArrayInputStream bais = new ByteArrayInputStream(bytes);

                  return bais;

}

}