6,663 karma · joined Feb 25, 2016 (10y ago) · 1,775 submissions
Previously AWS Cryptography (2019 - 2023).
Unless otherwise stated, my opinions are my own and do not reflect my employer.
https://scottarc.blog/about/
comment 7y ago · link · parent
XChaCha20 uses HChaCha20 to derive a 256-bit subkey between the 256-bit key and first 128 bits of the nonce. Then it uses ChaCha20 with the subkey and the remaining 64 bits of the nonce. ChaCha20 has an internal counter that goes between 0 and 2^64 - 1.
AEAD_XChaCha20_Poly1305 uses the first 32 bytes of the XChaCha20 keystream to determine the Poly1305 key for that message, then begins the encryption starting at the next block. (The remaining 32 bytes of block_counter = 0 are discarded in XChaCha20, but not in XSalsa20; this is a subtle difference that probably only makes streaming APIs easier to design and has no significant security considerations.)
With that in mind: XChaCha20 is already deriving a key from the key and (extended) nonce. And it already has an internal block counter (which side-steps counter/nonce wrapping issue that was addressed with AES-CTR in the AES-GCM-SIV design).
The simplest solution is to, instead of just trusting your CSPRNG, do this:
function crypto_aead_xchacha20poly1305siv_encrypt(msg, key) {
let nonce = Buffer.alloc(24);
sodium.randombytes_buf(nonce);
// Synthetic nonce here:
s2v(nonce, msg);
let cipher = Buffer.alloc(msg.length + 16);
sodium.crypt_aead_xchacha20poly1305_ietf_encrypt(cipher, msg, nonce, key);
return [nonce, cipher];
}
But this would be, strictly speaking, indistinguishable from XChaCha20-Poly1305 without SIV.For context: I authored the XChaCha20 RFC draft, implemented it in pure-PHP (twice; the second time was to support 32-bit systems).
comment 7y ago · link · parent
Here you go: https://nymag.com/intelligencer/2016/07/kiwi-farms-the-webs-...
They're terrible people who largely manage to avoid doing illegal (merely unethical) things as a hobby.
comment 7y ago · link · parent
TLS's AES-CBC is MTE not ETM, and that distinction matters [1]. You shouldn't use CBC mode in SSL/TLS. (You also shouldn't be supporting SSL; only TLS.)
But an application-layer AE construction [2] as described in the article is fine.
[1] https://moxie.org/blog/the-cryptographic-doom-principle
[2] https://github.com/defuse/php-encryption/blob/b87737b2eec06b...
comment 7y ago · link · parent
This could happen if they're relaxing their recommendations to double down on post-quantum cryptography.
This could happen if they had a mathematical breakthrough that invalidated all ECDLP security estimates.
I'll never know which it is. The pragmatic thing is to research PQCrypto and make sure the next generation of asymmetric primitives are as good as they can be.
comment 7y ago · link · parent
This was something I had observed in practice over the years (i.e. several orders of magnitude performance difference between AES-128 and AES-256 from my PHP implementations), and "your CPU only supports AES-NI for 128-bit keys" was the explanation I was given at the time. I haven't observed this recently, and I'm on newer hardware, so the explanation made sense.
In attempting to identify which CPUs were affected by this limitation, I've discovered that I was grossly misinformed about this. I'm going to update the article to redact this, ASAP.
UPDATE: Redaction applied.
comment 7y ago · link · parent
I absolutely am in favor of just using libsodium box/secretbox instead of having to understand this sort of nuance.
> Who is a laddered recommendation of different signing algorithms really helping?
People who ask me nitpicky questions about whether or not they should opt for 3072-bit RSA keys instead of 2048-bit RSA keys. The main purpose of the post was the first half (the "it doesn't matter" point).
comment 7y ago · link · parent
If you have the advantage of only working with newer hardware, this is true. But it's not immediately obvious whether or not your CPU supports 256-bit AES-NI without e.g. benchmarking OpenSSL.
The point isn't "AES-256 almost never supports AES-NI" (although that used to be true). It's that naively saying "biggest rock is best rock" doesn't always hold true.
> If you have to use RSA for some reason is there any scenario where you wouldn't also want 4096-bit keys?
You're sacrificing performance for a hypothetical security gain that probably won't matter. If 2048-bit RSA gets implicated by some new attack, it's more likely that 256-bit ECC will save you than 4096-bit RSA.
> https://latacora.micro.blog/2018/04/03/cryptographic-right-a... is an alternate, arguably better, source of information.
When people are asking for a guide on Cryptographic Right Answers, I always point people to that page.
The questions I wanted to address are about key size. And the point I wanted to stress was, "There are usually other factors that are far more important to consider than just the size of the key."
If I see a system that uses RSA to encrypt, I care more about it not using textbook RSA or poorly-implemented PKCS#1v1.5 padding than I do about 2048-bit vs 4096-bit keys.
comment 7y ago · link · parent
It doesn't really matter which you use under most threat models.
AES-128 gets you guaranteed AES-NI on virtually all processors sold in the past decade. AES-256 gets you better assurance against quantum attackers, should they ever become a real threat.
You can side-step both of these by just using a ChaPoly ciphersuite which is constant-time and fast on all platforms, without hardware acceleration. (If you ecide to just use libsodium's box/secretbox, as Thomas said in another comment, you're doing this side-step... which is thematically appropriate for a cipher named after a Latin dance).
495.
2019 Guide to Cryptographic Key Sizes and Algorithm Recommendations(paragonie.com ↗)
126 points · by CiPHPerCoder · 7y ago · 19 comments
comment 7y ago · link · parent
Please keep your shame to yourself. Your other comments in this thread sound like you're trying to invoke your shame upon others for declaring bankruptcy.
If your intention was consistently "I would still feel shame" rather than "You should feel shame", that's fine, but please make that clearer.
comment 7y ago · link · parent
In the rest of the business world, consultant means "freelancer, but professional".
If you choose to let the local stereotypes hold you back in life, then you won't succeed. End of.
500.
Searchable Encryption Doesn't Have to Be Bitter(paragonie.com ↗)
1 points · by CiPHPerCoder · 7y ago · discuss
comment 7y ago · link · parent
"Security at the expense of usability, comes at the expense of security."
Misuse-resistant cryptography API design is a particular hobby horse of mine. (My other hobby horse is software update security.)
A lot of the arguments in favor of cipher agility (a.k.a. runtime negotiation and risk of downgrade attacks) come from well-intended people who haven't internalized the past few decades of real world cryptographic failures.
I liken it to building a brick wall that's expected to hold up a roof.
Would you rather have a wall made by carefully placing bricks and mortar in place once, and if need be, rebuild the brick wall later with better materials?
Or would a lattice of mortar that lets you hot-swap bricks as needed be a preferable design?
The first one is versioned protocols. The latter is what keeps people typing AES into their code.
502.
Searchable Encryption Doesn't Have to Be Bitter(paragonie.com ↗)
2 points · by CiPHPerCoder · 7y ago · discuss
503.
CipherSweet: Searchable Encryption Doesn't Have to Be Bitter(paragonie.com ↗)
2 points · by CiPHPerCoder · 7y ago · discuss
504.
PHP Security in 2019(paragonie.com ↗)
3 points · by CiPHPerCoder · 7y ago · discuss
505.
PHP Security Roadmap for the Year 2019(paragonie.com ↗)
1 points · by CiPHPerCoder · 7y ago · discuss
comment 7y ago · link · parent
Do you honestly believe cybersecurity decisions should come down to how snazzy a homepage is, rather than a company's reputation?
> and you even put something like this without putting any sources
That article being discussed in this thread in particular quotes:
1. The opinions of other security experts
2. RFC 7515, section 4.1.1
3. The auth0 article about RS256/HS256 confusion
4. RFC 7518
5. The Adobe attack on ECDH-ES
What additional kind of sources do you need? The arguments should be sufficiently supported by the material available.
> This just looks like a poor attempt at making something 'better'.
By what metrics could we make this attempt less "poor"? What specific changes do you need to see?
508.
PHP Security Roadmap for the Year 2019(paragonie.com ↗)
3 points · by CiPHPerCoder · 7y ago · discuss
comment 7y ago · link · parent
https://github.com/paragonie/paseto/tree/master/docs/01-Prot...
It's similar to the advice given above, but also caters to that itch that some project managers have to only implement industry standards (which PASETO is slowly becoming).
comment 7y ago · link · parent
There was a recent (November 2018) talk at London Gophers about JWT Alternatives (slides here: https://speakerdeck.com/hako/exploring-alternatives-to-json-...).
Keep in mind that PASETO didn't exist until the middle of 2018, so the main reason "hardly anyone else" seems to use it is precisely because it takes time for standards to be adopted.
If you take a look at https://paseto.io, you'll see that there are implementations of PASETO (our proposed alternative) in multiple programming languages by other companies and individuals. All of these implementations are open source and under very permissive licenses (MIT or ISC).
Additionally, a great deal of time and effort went into the PASETO documentation, so that developers can understand not only how to implement it themselves, but also why it was designed the way it is. https://github.com/paragonie/paseto/tree/master/docs
Given all of the above, is it really fair to write PASETO off as an attempt to sell services?
Claiming that the original article is meant to sell services doesn't make sense either: If developers keep using unsafe tools, they will continue to be less secure and I'll have an easier time selling "make your products/services more secure" services to developers. The best thing to do, to meet such an incentive, is to say nothing publicly and let the easy money keep rolling in.
So one of two things is happening:
1. You don't correctly understand our intentions.
2. We're really bad at understanding our own incentives, and it's a miracle we've been in business for 4 years.