Scrypt isn't badly designd. It's also difficult to misuse.<p>This is like saying "bcrypt is badly designed."<p>Note that you are specifically attacking scrypt with the title -- "login.gov encryption" can be substituted with "scrypt."<p>If you were to say it's illegal for them to be using scrypt since scrypt is not an approved KDF, that would carry more weight.<p><i>Cryptographic flaws<p>1. scrypt is used as password-based KDF, which violates NIST 140-2</i><p>This isn't a cryptographic flaw! The phrase "cryptographic flaw" means something.<p><i>5. hash(E) is stored right next to the ciphertext from (4). Who thought that storing a hash of the encryption key right next to PII ciphertext encrypted with that key was a good idea?</i><p>Storing the hash of an encryption key is fine, as long as the hash function is strong.<p>It's frustrating that a government website is making solid cryptographic choices and then being lampooned like this. It would be far more productive to make scrypt an approved NIST KDF.
This is mostly complaining about a lack of FIPS 140 compliance. While that might be a regulatory issue for a .gov site, technically-speaking FIPS compliance is a hinderance to building a sound system, not an aid.<p>Putting that aside, there might be some valid points in here: using Hash(IKM + nonce) to generate a key is probably not ideal, depending on what Hash is. That's generally a job for HKDF. The post also mentions a "non-approved KDF" elsewhere, but doesn't say what it is.<p>On the other hand, storing Hash(key) isn't immediately an issue unless something else in the scheme depends on Hash(key) being secret, but the post implies without justification that it's some sort of obvious error.<p>So there might well be some issues here, but this post doesn't provide sufficient detail to condemn login.gov out of hand.
This is a rather sensational title for an article that amounts to "Login.gov does not use FIPS 140-2-compliant cryptography". Its main argument (aside from point 5) appears to be that scrypt is used in multiple locations, without passing judgement on scrypt itself.<p>Given that this is a US government-run system, this is still a compliance problem, but that's a different issue.
I opened an issue on their bug tracker a couple days ago because I had more fundamental questions about how their algorithm was designed.<p>HN comment: <a href="https://news.ycombinator.com/item?id=15204989" rel="nofollow">https://news.ycombinator.com/item?id=15204989</a><p>Github Issue: <a href="https://github.com/18F/identity-idp/issues/1665" rel="nofollow">https://github.com/18F/identity-idp/issues/1665</a><p>Now I may be misunderstanding their implementation, but it seems to me actually worse than "this isn't FIPS 140". I take no issue with their use of scrypt at all. The complaints in this Gist actually seem to miss the mark to me.<p>The problem isn't scrypt, or storing a hash. The real problem is storing <i>d</i> which, seems to me, defeats the purpose of using an HSM in the first place!<p>Again, with the disclaimer that I'm not 100% certain that's what they're doing, it's just what the documentation says, and what it seems like is happening from reading the Ruby code. I don't develop in Ruby, but while the language is fairly easy to read, with all their variables named 'encryption_code', 'encryption_key', 'encrypted_key', 'encrypted_code', etc. it's easy to get lost.<p>EDIT: Can someone please co-validate my analysis please? Or please tell me what I got wrong! From what I can see, the design is obviously broken. I don't consider myself qualified to find flaws in other people's crypto so, when I find obvious flaws in what should be well designed crypto I get a little freaked out.
I don't think "NIST" approved is that compelling of an argument.<p>If the author wishes to identify known vulnerabilities, that would be interesting.<p>FIPS has some various issues that actually increase vulnerability and not decrease it. Eg, FIPS approved OpenSSL was always an anchor that caused more problems than it solved.
What an immature analysis with click-bait title, I was expecting something big to read and it turns out he was just not happy about the site doesn't comply to NIST, and using scrypt is a <i>flaw</i>? Seriously?
Also note: scrypt ends with a PBKDF2 round, so if PBKDF2 is acceptable then scrypt may not actually be a problem. Legally speaking you might be able to ignore the use of the SMIX (including Salsa20) and the HMAC entirely as long as the final PBKDF2 uses a FIPS 140-2 acceptable hash function.
Hey, at least their transport security gets an A+ from SSL Labs. Honestly, I still find a lot of government sites, particularly state governments that get F's because they are still using SSL and 56 bit ciphers.<p><a href="https://www.ssllabs.com/ssltest/analyze.html?d=login.gov&latest" rel="nofollow">https://www.ssllabs.com/ssltest/analyze.html?d=login.gov&lat...</a>
The construction seems bad, but FIPS isn't anywhere close to being as good as NACL, and scrypt isn't the enemy. Bad constructions, lack of nuance and faith in certifications are the enemies.