Wednesday, January 14, 2015

Consume wcf service with wsHttpBinding using PHP Soap Client

Recently I wrote blog post on accessing wcf using php. But that was with basicHttpBinding. Somehow after long research I found how to consume wcf with wsHttpBinding. Follow the codes,







Read more ...

Tuesday, January 13, 2015

How to move WordPress from local server to live site

Many of us develop wordpress sites using local server in order to speed up the development process. Issue comes with moving website to live host. Even we configured MySql and wp-config.php files correctly we can see some broken links. Here I list down steps you need to host in a live environment.

Step 1 : Configure the Mysql


Log in to cpanel and create a database, add user and assign user to database





Step 2 : Change the wp-config.php file



Step 3 : Upload sql and files to live host


You can upload website files using ftp client or directly using cpanel file manager.

Upload sql


You need to log to phpmyadmin (localhost/phpmyadmin) in your local server and export database to .sql file



Open .sql using text editor and change the following changes according to your database name



Open your live phpmyadmin and import the .sql file



Step 4: Fix links


Run below sql queries according to your domain names




Everything should work now. Happy Wordpressing :)

Read more ...

Tuesday, July 15, 2014

Call WCF service using PHP

I have a WCF service used by a .net application. Due to some library issues I have to change .net application in to PHP language. Rather than creating a new web service, there is a simple way of accessing WCF using PHP. But there are few concerns. You cannot use WSHttpBinding with PHP. I have to change my bindings in to basicHttpBinding because PHP soap protocols are notsupporting wshttpbindings


Read more ...

Monday, March 24, 2014

Elliptic Curve Cryptography

Elliptic Curve Cryptography was proposed by Niel Koblitz and Victor Miller in 1985. This is based on algebraic of elliptic curves over finite fields and provided public key infrastructure to end user and it is considered as strong public key cryptosystem comparing with other algorithms like RSA. RSA is based on Integer Factorization Problem which means it is impossible or very difficult to find factor of very large prime numbers and that is an assumption. While ECC is based on elliptic curve discrete logarithm problem which means it is infeasible to determine discrete logarithm of point with multiplier in elliptic curve based on finite fields. Because of ECDLP feature elliptic curve cryptography can provide same security with small key size with related to other algorithms which can result speed computation with low memory, lower network bandwidth and lower power.  Most valuable feature in ECC is that it has highest strength per bit with related to other well-known cryptosystems. Therefore it is considered as high secure cryptosystem suitable for mobile devices.

The mathematical formula of ECC over the elliptic curve is
Y2 = X3 + aX + b

Where x, y, a and b are real numbers and with the condition
4a3 + 27b2 ≠ 0

By changing the values of ‘a’ and ‘b’ different elliptic curves can be generated. All the points which satisfy the above equation lie on the elliptic curve. Private Key is generated by random number generations while public key is obtained by multiplying the private key with a constant base point G (Scalar multiplication) in the curve. Public key is obtained as a point in this curve. ECC biggest advantage is its small key size, a 160 bit key size of ECC is equivalent in security to 1024 bit key size of RSA.
Read more ...

Monday, March 10, 2014

Clone objects C#

Cloning is a matter between copy object and copy its references. There are two types of cloning, deep clone and shallow clone. If you copy only references it’ll call shallow copy. If you copy referenced objects it’ll call deep copy.
Shallow copy:

Deep copy:
There are two ways of doing this.
1. Use the copy constructor (a good practice)
2. Using ICloneable interface
Manual way Using memberwiseclone
Read more ...

Monday, December 30, 2013

RSA Digital Signature C#

Using .net libraries we can easily implement RSA digital signature scheme. I wrote this blog post to explain how RSA digital signature algorithm works.

Here I get private and public key pair out of rsa object for more understandability of the code.

//Get rsaKeys

The following method will explain how to sign a message. You need to provide a private key and a message need to be signed. This method will be returned signed message.

//Sign message

Next step is verify the message that you signed using your private key. You need to pass original message, signed message and public key to method. This method will be returned boolean value verified or not.

//Verify message

To this point we are done with methods we need to sign and verify. Lets see how to use them. I wrote it in main method.

//RSA main


Read more ...

Monday, August 12, 2013

How to create your own ssl certificate

Developers have to use Digital Certificates very often. We can use self signed certificates to our development process rather than buying certificates from certificate authorities.

There are few simple steps to create our own certificates using visual studio.

Step 1

Open visual studio command prompt as administrator. You can get cmd as administrator by right click on short cut exists in visual studio tools and select run as administrator. (Not native windows command prompt)

Step 2:

Change the directory to where you want to create certificates. And type following command.



  • -sv yourprivatekeyfile.pvk is the name of the file containing the private key.
  • -n "cert name" is the name that will appear on the certificate (and in the certificate store).
  • yourcertfile.cer is the name of the certificate file.
  • -b mm/dd/yyyy is the date when the certificate becomes valid.
  • -e mm/dd/yyyy is the date when the certificate expires.
  • -r indicates that this will be a self-signed certificate.


Step 3:

Then you'll be prompted to enter the password for private key.


Step 4:

After you enter password you'll be prompted to enter password for sign certificate.


Step 5: 

This is the final step. Enter following command in cmd


Then it'll be prompted to enter private key password. Enter password and that's it.


  • -pvk yourprivatekeyfile.pvk is the private key file that you created
  • -spc yourcertfile.cer is the certificate file you created
  • -pfx yourpfxfile.pfx is the name of the .pfx file that will be created
You can see your certificates in hard disk






Read more ...

Sunday, May 5, 2013

Use Xgraph with NS2

XGRAPH is a general purpose x-y data plotter with interactive buttons for panning, zooming, printing, and selecting display options. It will plot data from any number of files on the same graph and can handle unlimited data-set sizes and any number of data files.

How to Install:
This example goes with two previous posts:
1. NS2 UDP Example
2. NS2 TCP Example

You will need both source code to plot ns2 simulations in this example.

Additionally we have to use these perl scripts to extract data from output trace generated from NS2.

I have written a shell script to do our job quickly.

Sample out put:
 



Read more ...