Skip to content

Releases: paragonie/ciphersweet

Version 4.7.0

11 May 06:49
v4.7.0
d7013e6
Compare
Choose a tag to compare

Enhanced AAD

  • Added a new AAD class, which allows users to bind an encrypted field to the contents of multiple plaintext fields. This class can be used in the same place where a field name or literal value was used previously.
  • EncryptedFile now accepts an optional AAD param, which binds the file's contents to the AAD value.
  • Improved test coverage.
  • EncryptedRow now allows you to automatically bind fields to their context (i.e. primary key).
  • EncryptedMultiRows now allows you to enable auto-binding mode, which ensures that all fields are explicitly bound (via the AAD parameter) to, at minimum, the database row primary key, table name, and field name.

Here's a quick example of the old API, then a diff to use the new AAD features:

<?php
use ParagonIE\CipherSweet\CipherSweet;
use ParagonIE\CipherSweet\EncryptedMultiRows;
/** @var CipherSweet $engine */

$multiRowEncryptor = new EncryptedMultiRows($engine);
$multiRowEncryptor
    ->addTextField('table1', 'field1')
    ->addIntegerField('table1', 'field2')
    ->addFloatField('table1', 'field3')
    ->addOptionalBooleanField('table1', 'field4')
    ->addTextField('table2', 'foo')
    ->addTextField('table3', 'bar');

$encrypted = $multiRowEncryptor->encryptManyRows([
  'table1' => ['field1' => 'hello world', 'field2' => 42, 'field3' => 3.1416],
  'table2' => ['id' => 3, 'foo' => 'joy'],
  'table3' => ['foo' => 'coy'],
]);

And here's how to easily enable to new features:

  $multiRowEncryptor = new EncryptedMultiRows($engine);
  $multiRowEncryptor
+     ->setAutoBindContext(true)
+     ->setPrimaryKeyColumn('table2', 'id')
      ->addTextField('table1', 'field1')

With this change, every encrypted field is explicitly cryptographically bound to its context (table name, field name) with no further action needed from the developer.

Additionally, table2 is cryptographically bound to its primary key (id). This has two consequences:

  1. You cannot copy ciphertexts between rows and decrypt successfully. This is a good thing.
  2. However, you must know the primary key when inserting new records, in order to provide it to CipherSweet.

That second point is the main reason why we are not enabling it by default. (Also, we'd kind of need to know your primary key naming convention, which we cannot know for everyone that uses this library.)

We will update the documentation as soon as possible.

Version 4.6.1

08 May 16:15
v4.6.1
Compare
Choose a tag to compare
  • Allow constant_time_encoding v3

Version 4.6.0

19 Apr 23:23
v4.6.0
e7e7193
Compare
Choose a tag to compare

What's Changed

Full Changelog: v4.5.1...v4.6.0

v3.4.1

19 Apr 23:22
v3.4.1
24db265
Compare
Choose a tag to compare

What's Changed

Full Changelog: v3.4.0...v3.4.1

Version 4.5.1

28 Oct 10:19
v4.5.1
Compare
Choose a tag to compare

More helpful exception message on NULL values. See #95, #92, #93.

If you do not declare a field optional, it generally will not accept NULL as a value on encrypt. Boolean is the exception to this rule (for backwards compat).

However, non-optional fields (even booleans) must have a ciphertext on the decrypt path.

Encrypt:
  TYPE_BOOLEAN + (null) -> ciphertext
  TYPE_OPTIONAL_BOOLEAN + (null) -> ciphertext

Decrypt:
  TYPE_BOOLEAN + (null) -> TypeError
  TYPE_OPTIONAL_BOOLEAN + (null) -> null

Booleans are the weird ones, though.

Encrypt:
  TYPE_TEXT + (null) -> TypeError
  TYPE_OPTIONAL_TEXT + (null) -> null

Decrypt:
  TYPE_TEXT + (null) -> TypeError
  TYPE_OPTIONAL_BOOLEAN + (null) -> null

Every other type doesn't tolerate null implicitly. This behavior is because of a very early design decision with boolean types.

Version 4.5.0

28 Jul 19:38
v4.5.0
Compare
Choose a tag to compare

What's Changed

  • #92 Explicit support for optional field types
  • #88 Support json field map templating

Full Changelog: v4.4.0...v4.5.0

Version 4.4.0

26 Apr 20:36
v4.4.0
59ee2e0
Compare
Choose a tag to compare

What's Changed

  • Feature: Extension Keys in #86

Full Changelog: v4.3.0...v4.4.0

Version 4.3.0

31 Mar 18:09
v4.3.0
Compare
Choose a tag to compare

New: FastCompoundIndex, FastBlindIndex

Too many users have tripped over the conservative defaults for blind indexing. To alleviate this, we are introducing two new classes in the public API:

  1. FastBlindIndex
  2. FastCompoundIndex

This will always use a fast hash; which will be more suitable for all but the absolute most sensitive data.

Version 4.2.0

15 Jan 19:07
v4.2.0
7459af6
Compare
Choose a tag to compare
  • Fix #80 (#81)
    • Add new methods setPermitEmpty() and getPermitEmpty(() to toggle whether empty values are tolerable in encrypted rows.

Version 3.4.0

15 Jan 19:11
v3.4.0
Compare
Choose a tag to compare