Miscreant: a multi-language misuse resistant encryption library
This library implements a crypto primitive that sacrifices a marginal but measurable amount of performance to avoid a very common user error with crypto primitives --- repeating a nonce (a cryptographic counter). For perspective, this week&#x27;s KRACK 802.11 bug is an instance of nonce reuse.<p>The primitive being provided here is an instance of SIV, which is widely considered the most conservative mainstream cipher mode that addresses nonce reuse. SIV is a moral cousin to Deterministic DSA and EdDSA, in that the &quot;nonce&quot; is based on a hash of the message. You can add additional nonce material, and that will improve the security of the system, but even with a constant all-ε stream of additional nonces, for most applications you&#x27;re fine.<p>The downsides to AES-SIV are that the mode is &quot;offline&quot; and two-pass. You have to have the whole message available to encrypt with AES-SIV (the state needed for CTR mode comes from processing the whole message). This makes some kinds of streaming interfaces hard to implement. On the other hand, you can almost always delegate that kind of interface up one layer in your application stack and pass AES-SIV chunks of messages.<p>This library or something like it will eventually hit some kind of &quot;1.0&quot;, and, at that point, if you can get away with the performance hit --- and you <i>virtually always can</i>, because bulk encryption isn&#x27;t a bottleneck in most systems, and on the systems where SIV&#x27;s performance hit matters you tend not to get much benefits from the &quot;faster&quot; stuff --- you should use this for bulk encryption. (Unfortunately, KRACK is a very good example of a setting that probably couldn&#x27;t get away with using AES-SIV). As a crypto interface, it&#x27;s better than NaCL.