News for hackers. Stuff that matters.
Re:Why I don't touch crypto by dobbsbob on Thursday July 11, 2013 @01:22PM (#6027484)
Good thing Satoshi wasn't scared of cryptography or we wouldn't have bitcoin. Also good thing the Truecrypt devs weren't scared of it, or the Debian devs, or the OpenBSD devs and others who gave us OpenSSH.

Moxie Marlinspike doesn't seem to be scared of it either. According to him it's not impossible to learn simple, tried and true methods for crypto engineering that are all spelled out in Schneier's books and various white papers. These standards were completely ignored by the cryptocat guys (and ignored repeated warnings from auditors). So if you can read, comprehend and do bare minimum research of NIST standards you're pretty safe rolling your own crypto software if you know about attention to detail, the doom principal, PRNGs and their flaws, and know not to attempt to make your own primitives. If you guy's can push out incredibly complex and relatively secure financial trading software there's no reason you can't roll your own SHA-256 on your Android phone replacing SHA-1 FDE or even design Redphone like Moxie did. Would also help if you hung around hashcat forums, read Schneier's cryptogram newsletter, and watched some lectures about software crypto engineering.

Re:Why I don't touch crypto by tptacek on Thursday July 11, 2013 @01:45PM (#6027675)
No, some "tried and true" methods of using crypto are in one of Schneier's books, _Practical Cryptography_. _Practical_ is great, but it's not complete, a fact mitigated by the effort Schneier and Furgusen go to in that book to convince people not to write casual crypto.

The methods described in _Applied Cryptography_ are unfortunately well-tried, but few of them are true. _Applied_ is an almanac of cryptographic concepts. Where _Practical_ tries hard to present best practices at every point in the book, _Applied_ instead strives for the broadest coverage; it's a survey, not an instruction guide. Unfortunately for all of us, ~20 years of _Applied_ readers have tried to put directly into practice the material in that book, much of which is (relevant to modern standards) half-baked.

It's also important to know that _Practical_ is also showing its age. There are very common, very serious vulnerabilities that _Practical_ does very little to prevent. For instance, "Design Rule 4" in _Practical_, "The Horton Principle", implies that message authentication should precede encryption. This construction is now disfavored; protocols that use mac-then-encrypt have been broken with side channels abetted by attacker chosen ciphertext.

Other concepts missing from _Practical_: elliptic curve --- particularly given endangered status of RSA, which would be a nit if not for the extremely detailed coverage Schneier gives to more theoretical threats to AES, (EC)DSA parameter tampering, the notion of minimizing randomness from cryptosystems, the modern AE modes, an in-depth treatment of side channels (where "in-depth" might mean "at least as much coverage as is given to the question of what block cipher mode to use") --- particularly error oracles, applications of hash collisions, RSA message formatting (it doesn't even cover OAEP), and secure key derivation.

I write this from a place of love; _Practical Cryptography_ is one of my all-time favorite software security books. It's one of those books you can "read backwards" to learn how to break systems in addition to learning how to build them. With age, though, _Practical_ is becoming more useful as a breaker's guide and less and a builder's guide.

There is no book anywhere that a generalist developer can read to learn how to build a secure cryptosystem from scratch, and generalist developers should be relying instead on high-level libraries like Keyczar and Nacl.

I don't know a think about Satoshi's competence (I couldn't, because nobody knows who he is), but Moxie Marlinspike has spent over 15 years building his competence. If you're Moxie, build whatever you want.

Re:Why I don't touch crypto by Osmium on Thursday July 11, 2013 @03:07PM (#6028397)
If I remember rightly, they actually say in Practical Cryptography that some of the worst crypto they've seen comes from people who've read Applied Cryptography and then decided to roll their own. Which is presumably one of the dangers in writing an "accessible" cryptography textbook is that then people who read it think they understand it... (I say this as a fan of Applied Cryptography, but more as an academic text -- I'd never dream of writing crypto code myself)
Re:Why I don't touch crypto by tptacek on Thursday July 11, 2013 @03:09PM (#6028411)
Applied is a good _book_; it's fun and interesting to read. But people should read it as pop science.
Re:Why I don't touch crypto by dfc on Thursday July 11, 2013 @05:25PM (#6029325)
What is the deal with Practical Cryptography versus Cryptography Engineering? I have frequently seen people say they are the "same book." How similar are they? The publication date is seven years apart. Did they just add a new foreword and change the title?
Re:Why I don't touch crypto by jessaustin on Friday July 12, 2013 @01:51PM (#6033951)
The very few changes from Practical to Engineering, summarized:

* Added a co-author (Tadayoshi Kohno)

* Added handy exercises for self-study (presumably the work of Kohno)

* Buried the opening "Design Philosophy" chapter in the following "Context" chapter, in a more nuanced, mature form

* Drops a discussion of UMAC for one of GMAC which is similar in that they both eschew the use of normal hash functions for something called a "universal" hash

* Discussion of OCB and CCM modes is updated with info about CWC and GCM, since that took place in the publishing interim

* Index is only a page longer, but seems more complete

* Reduced from 410 pages to 353, with a font that appears slightly larger and much less LaTeX-ugly; perhaps the kerning is better too?

That's all I found in 15 minutes of skimming. Note that flaws which were understandable in Practical are more glaring in Engineering: recommending XML where JSON would be better, advocating MAC-then-encrypt rather than encrypt-then-MAC, etc. I probably would not have purchased Engineering if I had realized how minor its updates were. It would be better to purchase if you don't own either book, though.

Re:Why I don't touch crypto by pbsd on Thursday July 11, 2013 @06:38PM (#6029749)
They are the same book; Cryptography Engineering is simply the 2nd edition, although they decided to change the title for some reason.
Re:Why I don't touch crypto by tptacek on Thursday July 11, 2013 @08:24PM (#6030164)
Everyone in our practice has a copy of one or the other, and the differences aren't at all significant. I'd buy whichever one you can get cheaper.
[deleted]
Re:Why I don't touch crypto by tptacek on Thursday July 11, 2013 @01:59PM (#6027794)
What a dumb comment; as if "security contractors" had anything to do with the quality of books, or didn't work in a field that overwhelmingly rewarded publishing vulnerability information.
Re:Why I don't touch crypto by dobbsbob on Thursday July 11, 2013 @02:31PM (#6028102)
That's why I wrote you should research all the new info like the Doom principal (encrypt then MAC) www.thoughtcrime.org/blog/the-cryptographic-doom-principle/

I dont think this is easy at all just lots of articles saying dont even try it, when I bet theres more than competent people here like you who could probably pull off impressive alpha software for long and thorough peer review instead of us all being stuck with decades old clunky software like Truecrypt or GnuPG Assistant.

Who knows maybe in a year cryptocat will be excellent software at least the devs listen to auditors now

Re:Why I don't touch crypto by tptacek on Thursday July 11, 2013 @02:41PM (#6028192)
In other words, you think that the people writing crypto software should simply do the work to become competent cryptographers. I strongly agree with you.

I find your sentiment about GnuPG a little galling. GnuPG is widely trusted and one of the most reviewed cryptosystems in the world; you advocate that it should be replaced --- by Cryptocat, no less --- because you find it "clunky". It's as if the thought hadn't occurred to you that a better exercise than designing one's own vanity cryptosystem might instead be to come up with a new UX for an existing trustworthy system.

I'm curious as to what web application you foresee supplanting Truecrypt, which is a full-disk encryption system whose entire UX is "enter the password to access this disk".

Re:Why I don't touch crypto by dobbsbob on Thursday July 11, 2013 @03:11PM (#6028424)
I wrote replace GnuPG Assistant not GnuPG. I have never had a problem using command line gpg or GPA but seems millions of ppl can't figure it out so they don't use it, thus NSA wins. I also dont think cryptocat should replace it (dont know where I inferred it should).

TC is clunky and has distro rights problems so a lot of releases like Tails are dumping it.

Re:Why I don't touch crypto by stplsd on Thursday July 11, 2013 @02:40PM (#6028186)
Any comments about "Handbook of Applied Cryptography"?

http://cacr.uwaterloo.ca/hac/

Re:Why I don't touch crypto by tptacek on Thursday July 11, 2013 @02:42PM (#6028197)
Re:Why I don't touch crypto by bigiain on Thursday July 11, 2013 @08:14PM (#6030119)
You're right, but there's still a valid point I think.

I'm a reasonably competent home mechanic. I happily rebuild engines and gearboxes for cars and motorcycles at home. I can modify and tune engines. I easily do all my households vehicle maintenance. And I happily help friends out with their repairs and maintenance. One thing I won't do though, is fix a friends brakes. I'm happy working on my own brakes, and happy to accept the responsibility for my actions. I won't take hat responsibility on for friends though. If you're not happy/capable of fixing your own brakes, take it to someone qualified and insured.

I think crypto is the same. There's nothing wrong with learning about and writing your own crypto as a curious amateur. But deploying that crypto where it can get other people killed is a bigger deal. Don't be "the cryptocat guy", "Oh yeah, I just found out you can't use water for brake fluid, turns out it boils when it gets hot! Who knew? Anyway, I just put brake fluid in my brakes, you should probably upgrade yours too sometime…"

I think if you want to _deploy_ crypto to other people, you owe it to yourself to have at least as much "professional training" as an auto mechanic gets before they're allowed to repair your brakes. And to further stretch the analogy - I'll point out tha most mechanics these days don't "repair" much in brake systems, they'll just replace large components - its becoming more common to not be able to buy seals and pistons any more - you're expected to just replace entire calipers or master cylinders. In my head that's the same approach as saying "I'll choose to use GPG or OpenSSL, but I won't 'do my own crypto'" - for someone who's _not_ prepared to put in a few hundred hours of proper crypto training, I think "rolling your own crypto software" is something best left to personal/educational projects, and never deployed I a way that other people might rely upon it.

Re:Why I don't touch crypto by betterunix on Thursday July 11, 2013 @01:41PM (#6027642)
"Good thing Satoshi wasn't scared of cryptography or we wouldn't have bitcoin."

...a system for which there is no security definition, no security proof, a known polynomial time attack (for some vague notion of "attack"), etc. I do not think this is the best example you can come up with.

One of the problems here is that cryptography cannot just be cobbled together from component pieces. Things do not always compose securely. Bitcoin is not a signature system, so even if the ECDSA implementation is perfect it does not guarantee that Bitcoin is secure. One of the things that makes cryptography, especially in the public-key setting, difficult is the very precise assumptions and very precise definitions of security; it is easy to make an assumption that is not implied by a security definition, and very easy to violate a key assumption without even realizing it. Worse, cryptosystems must be composed with other software, and such compositions can be insecure (which is basically what happened with Skype).

It's not that people should be scared away. Rather, we need to develop better tools that help programmers catch or avoid these kinds of bugs.

Re:Why I don't touch crypto by dobbsbob on Thursday July 11, 2013 @04:23PM (#6028952)
What I've been doing is just reading the code of already audited inplementations of cryptography to understand it better. For example Skein/Threefish. As a test to see what kind of speed SHA-3 would have on a mobile device I implemented my own Threefish SHA3 on Android for full disc encryption. First I looked at Pyskein, Java skein and all the other implementations released by pros. Then I looked at everything the authors who submitted other NIST3 finalists wrote, blogged and argued about on mailing lists. Then I read about the android SHA-1 design decisions. Then I watched lectures on crypto software engineering. Then I looked up everything about accelerometer side channels, PRNGs problems and gotchas, Moxies blog posts, and his yaffs source he used for whispercore, and went through tons of Dos and Dont comments both here and on Schneier's blogs about writing secure software. Then I watched BSDcon coding the openbsd secure way, and talked with maintainers who implement crypto on the openbsd mailing list.

Result is SHA3 full disk for Android. Its certainly not foolproof or nor do I claim its secure but a lot of people are digging through the source and forensics hackers are interested in seeing what they can do with it. I realize I broke cardinal rule of using something that hasn't been proven for decades first (like AES 256) but its been a good learning experience thats for sure.

Re:Why I don't touch crypto by tptacek on Thursday July 11, 2013 @04:26PM (#6028976)
I think it's hard to know what you don't know.
Re:Why I don't touch crypto by 23david on Thursday July 11, 2013 @02:13PM (#6027917)
Thanks for sharing your perspective and knowledge here.

Really important to know how to be safe and what to look out for. I wasn't getting the feeling that many infosec professionals on HN were able/willing to outline reasonable guidelines for experienced devs/admins to follow.

Re:Why I don't touch crypto by tptacek on Thursday July 11, 2013 @02:20PM (#6027980)
This too is an irritating statement given that me, Sean, and Marcin have been having 1:1 manual email correspondences with something like eight thousand strangers to teach them crypto attacks (the current standings are level 0 (8152), level 1 (608), level 2 (181), level 3 (61), level 4 (58), level 5 (42), level 6 (51) --- http://tinyurl.com/mtsocrypt).

What I perceive is that the problem isn't really that "infosec professionals on HN" are unwilling to teach developers, but rather that we're not teaching developers what they want to hear about crypto.

Re:Why I don't touch crypto by 23david on Thursday July 11, 2013 @02:47PM (#6028245)
Thanks for your hard work and for setting that up. Sounds like an awesome program. If I had more time right now, I'd love to check it out more.

I think we're on the same page here, but coming at it from different perspectives. I often have to find ways to secure as best as possible insecure systems that are already built. And I'm trying to find ways to incrementally improve systems over time so they get more and more secure.

I can't wait to deploy code until its 100% secure, or the startups I've worked for would just find someone else to do the job who wouldn't be a 'blocker'.

Re:Why I don't touch crypto by tptacek on Thursday July 11, 2013 @02:52PM (#6028285)
I appreciate your appreciation, and note also that we're well compensated in other ways for doing that work. The challenges will be around for several more months.

I'm just rebutting the idea --- which maybe you didn't mean --- that elitist infosec people were trying to set themselves up as gatekeepers. The opposite is true. Sean and I are working hard on getting as much of what we know about breaking cryptosystems into the challenges (set 7 is coming out probably next week, and I'm working on ECC stuff for set 8 now). We want the info out.

But look at the numbers I just posted: 8100 people have started the challenges. Just 51 people have managed to finish. I like the challenges a lot, but candidly: on the scale of professional cryptographic research, it's pretty basic; being among the 0.5% of challenge finishers wouldn't qualify you to design cryptosystems.

Re:Why I don't touch crypto by bigiain on Thursday July 11, 2013 @08:22PM (#6030154)
"I can't wait to deploy code until its 100% secure, "

That's fine if your working on a social network for cats, or another rage face Internet meme generator, but please don't use that excuse if you're storing my credit card details or health records (or writing an encrypted chat client you're promoting to political activists who's lives might literally depend on it).

Re:Why I don't touch crypto by josephlord on Thursday July 11, 2013 @02:16PM (#6027940)
For Bitcoin what would the consequences have been of getting it wrong at the beginning? Essentially no money would have been lost, no lives lost etc. Also it appears that the person who did create it had a good understanding of crypto and the recent literature (and may even have written it).

It is possible to learn it but learn it first and ship it to the public later or if you must with great big experiment/insecure warnings all over it.

Re:Why I don't touch crypto by dfc on Thursday July 11, 2013 @01:42PM (#6027659)
Satoshi is more than likely one or more individuals with significant crypto experience. Open{SSH/BSD/SSL} developers have significant crypto experience.

Don't get me wrong I am a huge Debian fanboy, but how much crypto code do Debian developers write?

Re:Why I don't touch crypto by dllthomas on Thursday July 11, 2013 @03:23PM (#6028512)
> how much crypto code do Debian developers write?

The historical answer seems to have been "too much"...

Re:Why I don't touch crypto by dfc on Thursday July 11, 2013 @05:09PM (#6029240)
The openssl keys were a disaster, no doubt. Are there other examples?
Re:Why I don't touch crypto by pilsetnieks on Thursday July 11, 2013 @09:12PM (#6030285)
I assume you meant the OpenSSL PRNG seed? (https://www.schneier.com/blog/archives/2008/05/random_number...)
Re:Why I don't touch crypto by dllthomas on Thursday July 11, 2013 @05:51PM (#6029484)
Not that I'm aware of; I was just referencing the one. But the one certainly provides some support for "don't touch crypto" as a good guideline.
Re:Why I don't touch crypto by dfc on Friday July 12, 2013 @01:23AM (#6031069)
Certainly provides support for "don't touch crypto" guidance, but that was not your original comment. I thought your response unfairly characterized the entire DD team over one incident.
Re:Why I don't touch crypto by dllthomas on Friday July 12, 2013 @09:15AM (#6032386)
I didn't mean to offend - it was good natured teasing. I use Debian myself.
Re:Why I don't touch crypto by mcguire on Thursday July 11, 2013 @03:50PM (#6028696)
Didn't they break OpenSSL quite significantly?
Re:Why I don't touch crypto by dllthomas on Thursday July 11, 2013 @04:34PM (#6029025)
http://www.debian.org/security/2008/dsa-1571

"Luciano Bello discovered that the random number generator in Debian's openssl package is predictable. This is caused by an incorrect Debian-specific change to the openssl package (CVE-2008-0166). As a result, cryptographic key material may be guessable."

Re:Why I don't touch crypto by betterunix on Thursday July 11, 2013 @01:49PM (#6027713)
"Satoshi is more than likely one or more individuals with significant crypto experience"

I doubt that very much, based on reading the original Bitcoin paper and his posts to the cryptography mailing list. More than likely Satoshi was an amateur/enthusiast.

Re:Why I don't touch crypto by lightyrs on Thursday July 11, 2013 @09:04PM (#6030266)
Please provide evidence that Satoshi exists.
Re:Why I don't touch crypto by kevinwallace on Thursday July 11, 2013 @10:04PM (#6030465)
Re:Why I don't touch crypto by lightyrs on Friday July 12, 2013 @07:15PM (#6035907)
I'm sorry — I should have said 'proof'.