4 ms·
This shows crypto is much too hard. You can configure a bunch of things, but half the choices you can make (key length, exponent, etc...) will render your encry
by norswap 13y ago
This shows crypto is much too hard. You can configure a bunch of things, but half the choices you can make (key length, exponent, etc...) will render your encryption worthless. I shouldn't have to know about the chinese remainder theorem to use crypto properly.
- Nursie 13y ago>> This shows crypto is much too hard. Crypto is hard, and you shouldn't really be making these choices. >> I shouldn't have to know about the chinese remainder theorem to use crypto properly. Then stay out of it. Choose a library/framework that is popular, well tested and high level enough that you don't have to make these choices.
- norswap 13y agoAny pointers? And I don't something that will take care of everything for me, but simply a pair of encrypt / decrypt functions.
- Nursie 13y agoThe usual ones to recommend here are KeyCzar and NaCl (apparently pronounced salt, not related to saltstack AFAICT). NaCl in particular provides simple Public/Private and Symmetric modes. The Authenticated Encryption Symmetric mode here is good - http://nacl.cr.yp.to/secretbox.html http://nacl.cr.yp.to/secretbox.html
- kevinpet 13y agoHis complaint is that crypto is to hard to use. This is a valid complaint and "don't do it" isn't a valid solution. Too many "libraries" consist only of implementations of the crypto algorithms, but don't give any help with the proper use.
- Nursie 13y ago>> His complaint is that crypto is to hard to use. Yes, and if you're going to use low level constructions he's right, and that will never change. >> This is a valid complaint and "don't do it" isn't a valid solution. Except that's not what I said, I said find a higher level library. When he asked I gave examples. >> Too many "libraries" consist only of implementations of the crypto algorithms, but don't give any help with the proper use. Then these may be the wrong libraries to use to secure your application. Great libs to poke around in the lower levels for a variety of other purposes of course.
- nieve 13y agoDoing your own crypto is generally hard and risky, but with a little googling there are often reasonable defaults and suggestions available from trustworthy sources. The biggest danger seems to be that people pick some random set of values & constructions and assume that's good enough without further checking. On the flip side this should have set off warning bells for them - it can be a little bit of a code smell to pick 1 for a configurable value in your encryption. Not always a bad choice, but 1 has a lot of properties that can simplify various mathematical operations and Basically setting a crypto value to the smallest positive integer (and a non-prime at that!) is like deciding that a set of numbers in your code should always be represented by two-byte signed ints. Sometimes that's _exactly_ what you want (say, various fast math libraries), but if you're doing general purpose code you should really stop and think about whether you might end up with a value outside that.
- homeomorphic 13y ago> This shows crypto is much too hard. You can configure a bunch of things, but half the choices you can make (key length, exponent, etc...) will render your encryption worthless. I shouldn't have to know about the chinese remainder theorem to use crypto properly. This attitude scares me. Some things really are hard to do. Some things really are hard to understand. Some are even both. Remember what Euclid is supposed to have said to Ptolemy I of Egypt when the king complained that geometry was hard to learn: There is no royal road to mathematics! There's no shame in not being able to do or understand every difficult thing under the sun, but don't complain that such things "shouldn't be so hard". They often are. I think it's part of what makes life interesting.
- norswap 13y agoI expressed myself poorly. What I meant is that using cryptography shouldn't be that hard to use for the uninformed user. Introducing cryptography in an application is about security, and if we want more secure applications, cryptography should be easy as pie to use. Of course cryptography is hard, and it is an interesting topic (one I know a few things about as it turns out).
- jerf 13y agoI'm sort of split in the middle on the two sides here, but as an example of what I would hope for, in this case I'd say passing a 1 to this function in that location should have resulted in a run time error, not a happy useless implementation. Preferably with an error message that points to some helpful documentation on the topic. That's an example, that can't solve everything, and I'd despair of trying to fix every possible stupid error that way, but it would be helpful. That's not even really a "security" concern, that's just good software engineering. Passing this function something that fails the prerequisites ought to be checked. (And yes, I'd check that it's prime, too. It's an expensive check once, but trivially memoized, and you can even prefill the memoization with the usual 65537 value to make it even cheaper. In this particular case, IIRC, the exponent is always or nearly always simply reused,)
- 13y ago
- deleted 13y ago[deleted]
- mikeash 13y agoI shouldn't have to know about weather to fly an airplane. I shouldn't have to know about gasoline to drive a car. What's wrong with these statements? The universe doesn't care that something "should" be easy.
- knite 13y agoYou CAN fly a plane without knowing about the weather, because the pilot does the flying for you. All you want is to get from point A to point B via plane. A crypto library is the pilot. A crypto library that allows you to use insecure settings is a pilot who crashes the plane into a mountain because you asked him to.
- mikeash 13y agoI think the analogous entity for "pilot" would be "application". The library is analogous to the airplane, and airplane will fly into a mountain when you ask it to.