Have you every tried learning cryptography? How was your experience?
I am currently doing my M. Sc. Applied IT Security. Before deciding to study it, I used OWASP to get an idea of the practical side and how to apply what and which kind of things to keep in mind. However, now that I started my studies, I can promise you that it's lots of Math and you should not attempt to self-learn it.
You can learn many things by yourself, for example programming. When you make mistakes, things will break and you will know that you did a mistake, because something will stop working. If you, however, do a mistake in IT security and things break, you might not find out that something went wrong (for example: web servers tend to work even though they use outdated ciphers). However, the bad guys will find that attack vector, and they will use it for bad things. They will not tell you about the security problem.
So, if you want to learn about rudimentary security, go for OWASP projects and the OWASP wiki, they are very good! However, for important things, always get a specialist. In case you want to learn the in-depth knowledge and become a specialist yourself, STUDY IT at a University.
If you want to have a peek at stuff you will learn, go and buy this book. Read it and do the exercises. If you are still interested, remember that the Math part will become more difficult and that you will have to keep all those algorithms in mind and also be able to think about ways to attack the ciphers (both, practical and mathematical) ;)
lots of math, lots of bit mask representations. that's what I've got so far and I'm only implementing cryptographic standards. I don't have to invent them :) .... Todd aren't you going for security ? do you have any hints ?
Todd
Software Security TechLead
I'm currently doing heavy study (up to 12 hours a day sometimes, and even on weekend nights after my girlfriend goes to bed) on malware analysis, reverse engineering, and related subjects including crypto, because we often have to break crypto to analyze malware.
"Learn cryptography" is sort of a broad term. Do you want to learn how to write current algorithms? Are you looking to develop new crypto algorithms entirely? Or are you looking at learning more about the subject for hobby/work reasons to help better make a decision on which algorithm you should implement?
The reason I ask is because these are all entirely different things which require different types of study and training. If you really want to develop your own algorithms, the most important thing to note is that it isn't a quick thing; but it's possible... Just realize you'll be putting aside a few years to study cryptography and mathematics. If that sounds like what you want, you're going to want to study the work of Bruce Scheier, Christoph Paar, and Ronald Rivest, to name a few. Go and read Applied Cryptography by Bruce Scheier and Understanding Cryptography by Christoph Paar. Paar and Scheier both have lectures on YouTube as well, although IMO Paar is pretty dry verbally and he also tends to misuse English words since it's not his native tongue. I think it's silly when people try to act like it's some impossible subject that only an elite couple people can learn and practice... Every occupation is specialized and requires training. When people say this, what they're really trying to say is "don't think you can be just a regular programmer and write your own crypto algorithms." This is true... It's an entire other area of study that requires years to learn and get adept with.
For some reason there's a level of ignorance in the programming community surrounding this though... It's very evident because any time someone brings up crypto on any forum, even StackOverflow, they get slammed 100 times over about "don't roll your own" "don't do it," etc... The more proper answer would be this: If you plan on writing your own crypto algorithms, you need to first learn current cryptographic methods by reading the books I suggested, then you need to develop your own and get it peer-reviewed by professional, well established cryptographers and mathematicians around the globe before putting it into production. Following that simple advice, if you can get the support of them, then you can roll your own algorithm. Notice, this advice is much more pragmatic (and fulfilling) than "don't roll your own" or "you can't."
However, the "developing your own algorithm" part is only one piece of the puzzle, and for me personally, it's not where I'd like to spend most of my time. As a programmer, we have certain powers over cryptography just as cryptographer has powers over us. For example, 99% of the time, cryptography is not "broken" mathematically, but ways around it are found, ways to bypass it, etc... These ways are equally as good as the crypto itself. You could have 100 crytographers and mathematicians spend 7 years on an algorithm and I may be able to find the key stored in an insecure location of memory, or set up an antenna and listen to the CPU's electromagnetic signature and derive the bit stream of the key from that.
Hollywood likes us to believe that hacking and breaking secure systems is all about "breaking the secret code" or the crypto, but that's because it makes good movies. Real attackers think outside the box, and frankly can just step around crypto most of the time... Google "Side-Channel attacks" and you'll see what I mean. In fact, I know a guy who wrote a program that when active on a computer, it will pull ANY AES key from memory instantly... It's not because AES is weak, it's because memory isn't secure. Computers are inherently weak at the endpoint because the processor must follow instructions. Thus, those instructions must at some point be exposed, and they can be exploited. You can encrypt the secret recipe all you want but at some point, you must show it to the cooks or chefs, and if the enemy is secretly in the room, it's compromised.
Another example is in malware analysis. Malware authors try to hide the malware code from us and from anti-virus (if its encrypted it can't be detected) by encrypting it. However, what malware analysts do is we run the malware in a debugger, throw a breakpoint in there near the decryption stub, and we step through the code until the malware decrypts itself so that it can be run. We then dump the decrypted bytes to a file on disk, repair the file header, then open it up in analysis software. This is another example of a strong crypto algorithm still getting defeated.
Two more examples... Malware often stores its crypto key in an insecure area of memory and it can be nabbed from there.. And last but not least, malware authors and programmers alike also often use a plain random number generator, when they need to be using a cryptographically secure, pseudo random number generator (CSPRNG). Another thing I've found that programmers do is they'll use a CSPRNG even, but what they'll do is they'll burn the entropy away from it, creating security holes. For example, they may us a CSPRNG, but then filter out certain bytes.... Bringing the total possibilities down from 2^256 or something, to just 2^32, which can be brute-forced in a couple hours. A good example of some of this stuff in action is in the following video, where the author destroys ransomware. He's made a living off of breaking programmer's lousy crypto:
I also posted a blog post which demonstrates how easy it is to break through a poorly coded encryption: toddcullumresearch.com/2017/03/26/inline-hook-of-… - scroll down to about halfway down the page. For a reverse engineer who spends all day staring at opcodes and assembly, a crypto algorithm is actually extremely easy to spot and there are even tools which help find them instantly.
So decide for yourself, "Do I want to learn cryptography as a discipline?" ORRR "Do I want to learn cryptography applied to programming and discover unique ways to break and bypass it?" For me, it was the latter because in the end, the goal is to either secure a system or break into one... Cryptography is only one means to an end, and sometimes, it can be sidestepped by a 17 year old.
EDIT: SPEAK OF THE DEVIL.. I was off by 1 year: