Commit graph

525 commits

Author SHA1 Message Date
Peter Taoussanis
23276ac910 [#101] NB Change default encryption from AES-CBC to AES-GCM
Why?

  - AES-GCM is faster and can be more secure, Ref. https://goo.gl/Dsc9mL, etc.
  - AES-GCM is an authenticated[1] encryption mechanism, providing
    automatic integrity checks. This is relevant to [#101].

What's the issue with #101?

  - We    compress then encrypt    on freeze ; Reverse would make compression useless
  - So we decrypt  then decompress on thaw

Attempting CBC decryption with the wrong password will often but not
*always* throw. Meaning it's possible for decompression could be
attempted with a junk ba. And this can cause some decompressors to
fail in a destructive way, including large allocations (DDoS) or even
taking down the JVM in extreme cases.

Possible solutions?

  - We could add our own HMAC, etc.
  - And/or we could use something like AES-GCM which offers built-in
    integrity and will throw an AEADBadTagException on failure.

There may indeed be reasons [2,3,4] to consider adding a custom HMAC -
and that's still on the cards for later.

But in the meantime, the overall balance of pros/cons seems to lean
in the direction of choosing AES-GCM as a reasonable default.

Note that the change in this commit is done in a backward-compatible
way using Nippy's versioned header: new payloads will be written using
AES-GCM by default. But old payloads already written using AES-CBC will
continue to be read using that scheme.

References
  [1] https://en.wikipedia.org/wiki/Authenticated_encryption
  [2] https://www.daemonology.net/blog/2009-06-24-encrypt-then-mac.html
  [3] https://blog.cryptographyengineering.com/2011/12/04/matt-green-smackdown-watch-are-aead/
  [4] HMAC vs AEAD integrity,           https://crypto.stackexchange.com/q/24379
  [5] AES-GCM vs HMAC-SHA256 integrity, https://crypto.stackexchange.com/q/30627
2019-01-06 14:13:34 +01:00
Peter Taoussanis
ae8baa639d [Crypto] Misc housekeeping, prep for next release 2019-01-06 12:24:29 +01:00
Peter Taoussanis
b0c7a0f8c7 [Crypto] Rename some arguments for extra clarity 2019-01-06 12:24:29 +01:00
Peter Taoussanis
7f9b075ba7 [#114] PR housekeeping 2019-01-06 12:24:29 +01:00
Isak Sky
abb55da29e [#113 #114] Support object arrays (@isaksky) 2019-01-06 12:24:29 +01:00
Peter Taoussanis
d2252d8e21 Bump deps 2019-01-06 12:24:29 +01:00
Peter Taoussanis
5a705ca79e v2.15.0-alpha4 2018-10-07 09:39:28 +02:00
Peter Taoussanis
cfc904799b [Crypto] Rename prng->srng
Better reflects the fact that the source of randomness is now
actually conditional (e.g. via InstanceStrong).
2018-10-07 09:38:48 +02:00
Peter Taoussanis
90f0ff9315 [Crypto] sha512-key-ba: support utf8 *or* ba keys
Minor convenience.
2018-10-06 13:52:45 +02:00
Peter Taoussanis
c83572f0a8 [#112] PR housekeeping 2018-10-06 10:22:13 +02:00
Isak Sky
67dde8d7bd [#83 #112] Add support for deftype (@isaksky) 2018-10-06 09:57:35 +02:00
Isak Sky
192666c09e [#83 #113] Add URI support (@isaksky) 2018-10-06 09:50:24 +02:00
Peter Taoussanis
972c637ff4 v2.15.0-alpha3 2018-09-23 19:39:59 +02:00
Peter Taoussanis
e16c64c4f4 [Crypto] Add secure rand-nth fn 2018-09-23 19:38:51 +02:00
Peter Taoussanis
f6c17a7411 [Crypto] Tune prng re-seeding frequency 2018-09-15 22:20:27 +02:00
Peter Taoussanis
bfc65f0970 v2.15.0-alpha2 2018-09-15 12:01:07 +02:00
Peter Taoussanis
d7993bb469 [Crypto] Add more hashing fns
Specifically:

  - `sha512-ba` (without key salting, etc.)
  - `sha256-ba`
  - `murmur3` (Clojure 1.6+)
2018-09-15 11:56:40 +02:00
Peter Taoussanis
82bb2f0104 [Crypto] Randomness improvements
Specifically:

  - Now use blocking `getInstanceStrong` when available (Java 8+)
  - Now auto reseed prng after every ~10k calls (slower but safer)
  - [BREAKING] Support arbitrary random-bytes fn
  - Added new `rand-x` fns (double, long, bool, gauss)
2018-09-15 11:36:03 +02:00
Peter Taoussanis
7fa1d3686c v2.15.0-alpha1 2018-09-08 19:38:41 +02:00
Peter Taoussanis
868a8f65de [Encryption] Rewrite encryption ns to build off new crypto ns 2018-09-08 19:28:02 +02:00
Peter Taoussanis
2dec26fd95 [Encryption] Add a new (private, alpha) taoensso.nippy.crypto ns with low-level utils
Specifically:
  - Exposes ability to use arb crypto algorithm
  - Exposes ability to use arb key function
  - Supports explicit salts (incl. variable salt length)
  - Supports arbitrary key length (e.g. AES 256)
  - Defaults to AES/GCM/NoPadding algorithm
2018-09-08 19:28:02 +02:00
Peter Taoussanis
2812ffa6e5 [Encryption] Housekeeping, no behavioural changes 2018-09-08 15:10:51 +02:00
Peter Taoussanis
6a63950455 Bump deps 2018-09-08 14:58:12 +02:00
Peter Taoussanis
4448d2f2ab README: mark v2.14.0 as stable 2018-05-05 17:40:29 +02:00
Peter Taoussanis
b3a78fa30e v2.14.0 2017-12-21 11:05:06 +01:00
Peter Taoussanis
99748d9c0b Bump deps 2017-12-21 10:47:30 +01:00
Peter Taoussanis
2272d5ea57 [#104] Micro-optimization: remove unnecessary runtime 'if' in extend-freeze macro (@scramjet) 2017-12-21 10:47:30 +01:00
Peter Taoussanis
1a8a44286a [#93] Pickup record redefinitions at REPL, etc. (@smee) 2017-12-21 10:12:33 +01:00
Peter Taoussanis
0819ede2c1 CHANGELOG typo 2017-02-13 18:12:34 +01:00
Peter Taoussanis
e57057e6c4 v2.13.0 2017-02-13 17:59:18 +01:00
Peter Taoussanis
ded6cc034f [#91] Add convenience utils for freeze/thaw to/from files
Suggested by @Engelberg (thanks Mark!).

Also seems to be a common question online, e.g.:
http://stackoverflow.com/q/23018870
2017-02-13 17:52:19 +01:00
Peter Taoussanis
ffa4b494b3 Bump deps 2017-02-13 17:00:56 +01:00
Peter Taoussanis
a0ca70c9dc v2.13.0-RC1 2016-12-17 12:15:17 +01:00
Peter Taoussanis
a41c391889 Bump deps 2016-12-17 11:56:46 +01:00
Peter Taoussanis
bc33489dce Bump 1-byte cache count: 5->8 2016-10-28 16:52:05 +07:00
Peter Taoussanis
bc5f045979 Revert experimental semi-auto key caching 2016-10-28 16:37:54 +07:00
Peter Taoussanis
7c8acfe663 Experimental: optional semi-auto key caching 2016-10-28 16:36:04 +07:00
Peter Taoussanis
4aa1a3b871 ns form housekeeping 2016-10-28 10:25:46 +07:00
Peter Taoussanis
56b3f5c365 Update docs for v2.12.2 hotfix 2016-10-17 15:54:53 +07:00
Peter Taoussanis
a4d15232dc Bump deps 2016-10-17 15:33:21 +07:00
Peter Taoussanis
dee62aa0fc [#85] Lazily create LZ4 instance, fixes issue with Google App Engine 2016-09-01 13:57:25 +07:00
Peter Taoussanis
0894ecffce v2.12.2 2016-08-23 22:34:14 +07:00
Peter Taoussanis
2eb3d25dba Hotfix: deprecated private API typo 2016-08-23 22:33:34 +07:00
Peter Taoussanis
e1ca795466 v2.12.1 2016-07-26 12:24:57 +07:00
Peter Taoussanis
8350149a1e Bump encore dep: 2.67.1 -> 2.68.0 2016-07-26 12:24:57 +07:00
Peter Taoussanis
5c94841313 De-deprecate type ids 6, 80
Conceptually simpler to just retain these as first-class thaw-only
types.
2016-07-26 12:22:23 +07:00
Peter Taoussanis
c1d48c7ef9 Hotfix: missing thaw routines for deprecated type ids: 6, 80
Ref. https://github.com/ptaoussanis/faraday/issues/98
2016-07-26 12:06:23 +07:00
Peter Taoussanis
9bac40e705 v2.12.0 2016-07-24 15:56:01 +07:00
Peter Taoussanis
a8faac734c Sync housekeeping 2016-07-24 15:48:09 +07:00
Peter Taoussanis
e07ec91f41 Misc housekeeping 2016-07-18 11:50:39 +07:00