Live data from Hacker News

Cryptographic Best Practices

gist.github.com

1–10 of 53 posts

Re: Cryptographic Best Practices

#3
I laughed when I read that GCM is hard for library authors. I remember trying to implement GCM but failing, so I decided to transcribe a "simple implementation" but failed at that also.

Then I decided to try OCB mode and it worked on the first try.

By the way, isn't OCB unpatented as of recently?

Re: Cryptographic Best Practices

#4
post #3

I laughed when I read that GCM is hard for library authors. I remember trying to implement GCM but failing, so I decided to transcribe a "simple implementation" but failed at that also. Then I decided to try OCB mode and it worked on the first try. By the way, isn't OCB unpatented as of recently?

I hadn't heard about OBC being unpatented, but then the Wikipedia pointed me to this email to the ietf cryptography forum: https://mailarchive.ietf.org/arch/msg/cfrg/qLTveWOdTJcLn4HP3...

So... yes... it looks like OCB is no longer encumbered.

I am curious why GCM was hard. Hard to do without side-channel leaks I can understand, but 800-38D seemed straight-forward.

Re: Cryptographic Best Practices

#5
> Putting cryptographic primitives together is a lot like putting a jigsaw puzzle together, where all the pieces are cut exactly the same way, but there is only one correct solution. Thankfully, there are some projects out there that are working hard to make sure developers are getting it right.

I found this analogy muddled.

The first sentence sounds like a good thing. There's only one correct solution for a puzzles pieces and that is obvious. We all see when the puzzle's been correctly finished because the pieces only fit one way, and a completed image is the result.

Sounds like a great situation.

Then the second sentence responds as if this is a problem that needs to be fixed.

For a less ambiguous analogy, how about a lego set, without instructions? You're supposed to build one particular model, but could end up building all kinds of things that may well use all the pieces, but don't end up with the correct model.

Re: Cryptographic Best Practices

#6
post #5

> Putting cryptographic primitives together is a lot like putting a jigsaw puzzle together, where all the pieces are cut exactly the same way, but there is only one correct solution. Thankfully, there are some projects out there that are working hard to make sure developers are getting it right. I found this analogy muddled. The first sentence sounds like a good thing. There's only one correct solution for a puzzles…

The cut of jigsaw puzzles determines how they can be put together, but what determines how they should be is the picture painted across them.

So an ideal jigsaw puzzle has no two pieces with the same cut, preventing you from putting any pieces together incorrectly. This is largely impossible. A jigsaw puzzle where every piece has the same cut, however? That’s simply torture.

Re: Cryptographic Best Practices

#7
Can someone help me understand this recommendation:

Under symmetric encryption, the authors write:

> If you are in a position to use a key management system (KMS), then you should use KMS. If you are not in a position to use KMS, then you should use authenticated encryption with associated data (AEAD).

These seem orthogonal to me. KMS := how keys are generated and distributed to communication partners. AEAD := how data is encrypted between communication partners using those keys.

How can it be “use a KMS if you can _or else_ use AEAD”? Shouldn’t it be “and”? What am I missing?

Re: Cryptographic Best Practices

#8
post #5

> Putting cryptographic primitives together is a lot like putting a jigsaw puzzle together, where all the pieces are cut exactly the same way, but there is only one correct solution. Thankfully, there are some projects out there that are working hard to make sure developers are getting it right. I found this analogy muddled. The first sentence sounds like a good thing. There's only one correct solution for a puzzles…

The cut of jigsaw puzzles determines how they can be put together, but what determines how they should be is the picture painted across them. So an ideal jigsaw puzzle has no two pieces with the same cut, preventing you from putting any pieces together incorrectly. This is largely impossible. A jigsaw puzzle where every piece has the same cut, however? That’s simply torture.

Ok, thanks - so the "cut exactly the same way" is the key here. It's maybe not so obvious to non-puzzle aficionados? I thought it simply meant "all fit together", the "same way" referring to the overall cut.

Maybe clearer: "each puzzle piece the exact same shape"?

Though it still suffers from the issue, as with a puzzle there's always the congruity of the final image as a hard guide as to what's meant to be correct, regardless of piece shape. That's maybe what muddles the analogy most.

Re: Cryptographic Best Practices

#9
post #3

I laughed when I read that GCM is hard for library authors. I remember trying to implement GCM but failing, so I decided to transcribe a "simple implementation" but failed at that also. Then I decided to try OCB mode and it worked on the first try. By the way, isn't OCB unpatented as of recently?

I hadn't heard about OBC being unpatented, but then the Wikipedia pointed me to this email to the ietf cryptography forum: https://mailarchive.ietf.org/arch/msg/cfrg/qLTveWOdTJcLn4HP3... So... yes... it looks like OCB is no longer encumbered. I am curious why GCM was hard. Hard to do without side-channel leaks I can understand, but 800-38D seemed straight-forward.

I have no mathematical background at all (I am an orchestra musician), and I did get it to mostly work. It was just that it didn't work for some inputs, and I could never figure out why despite having access to a proper debugger and a good repl (in scheme).

OCB was a breeze in comparison.

Caveat: I never understood the birthday attack from Ferguson on OCB and why it doesn't work on GCM, so I am really not the right person to make any recommendations

Re: Cryptographic Best Practices

#10
I noticed there's no mention of quantum-resistant crypto. Looking around, it looks like this is the rational [1]. This sort of feels like a hand-wave.

> Quantum computing does give us some far more efficient algorithms that classical computing cannot achieve, but even then, 256-bits still remains outside of the practical realm of mythical quantum computing when brute force searching.

[1] https://pthree.org/2016/06/19/the-physics-of-brute-force/

Post reply on HN