Side-Channel Analysis: Countermeasures and Application to Embedded Systems Debugging