Power analysis and exponentiation by squaring I am trying to understand how one can retrieve the secret exponent via a simple power analysis.

Lets suppose that the exponentiation by squaring algorithm is implemented in its simplest form :

Function exp-by-squaring(x,n)
    if n&lt;0 then return exp-by-squaring(1/x, -n);
    else if n=0 then return 1;
    else if n=1 then return x;
    else if n is even then return exp-by-squaring(x2, n/2);
    else if n is odd then return x * exp-by-squaring(x2, (n-1)/2).


As i understand,if i am to probe the consumption while the machine is calculating the exponent i will be able to see the individual operations on the spectrogram. There will be a spike between different operations so i will be able to tell when it entered the "even" condition or when it entered the "odd" condition. This simply gives me an idea about the exponent and not the actual exponent.

So if the secret exponent is 2012 (https://math.stackexchange.com/questions/563708/exponentiation-by-squaring), i will simply see that the even condition was entered 6 times and the odd condition was entered 4 times but how exactly do i use that information to find the secret exponent?

Thanks in advance
You can begin by first reading the seminal paper of Paul Kocher. He gave the reference for Timing and Power analysis attacks. The best is to read the papers, and understand the philosophy of Side Chanel Attacks.
The method he described, has been enhanced by many authors, and it become impossible to ignore how to securelly implement algorithm on embedded systems.
After that the most destructive attacks is the one introduced by Dan Boneh known as the "Faults Attack".