Vladimir Soukharev, Cryptographer, InfoSec Global Inc. and Basil Hess, Software Engineer, InfoSec Global. A cryptographic scheme may be secure from a theoretical point of view. In practice, however, such scheme still may be vulnerable to side-channel attacks (SCAs). These attacks monitor such analog characteristics of the cryptographic hardware as power consumption, timing, radio frequency or sound emissions and use this data to break the cryptographic scheme. The two main types of SCAs are simple and differential. Using physically shielded crypto devices is one of the approaches to protect against such attacks but this approach has many limitations and reduces flexibility of the schemes. We present a software-based protection approach which does not depend on the platform used by a cryptographic algorithm. In general, countermeasures slow down a cryptographic implementation, therefore a very careful analysis is required in order to apply them only when necessary. To improve performance, we use optimizations in the most efficient way, while ensuring that they do not conflict with the applied countermeasures. This presentation provides a careful analysis of elliptic curve-based schemes, and how to optimally combine countermeasures and optimizations for them to obtain secure and, at the same time, efficient schemes. This is achieved by combining previously existing methods with innovative methods that provide extra efficiency. Then we expand our approach to countermeasures against fault-injection attacks at the software level.