paragonie/halite
Halite is a high-level PHP cryptography library from Paragon Initiative Enterprises, built on libsodium. It provides safer, opinionated APIs for encryption, authentication, key management, and password hashing, helping you use modern crypto correctly with minimal foot-guns.
http:// links with the https:// URL they redirect to by @GrahamCampbell in https://github.com/paragonie/halite/pull/196final from private methods by @junaidbinfarooq in https://github.com/paragonie/halite/pull/204Full Changelog: https://github.com/paragonie/halite/compare/v4.8.0...v4.9.0
Full Changelog: https://github.com/paragonie/halite/compare/v5.1.2...v5.1.3
#[SensitiveParameter] annotation on some inputs
HiddenStringinfo parameter instead of the salt parameter. This allows us to meet the KDF Security Definition (which is stronger than a mere Pseudo-Random Function).File class no longer supports the resource type. To migrate code, wrap your resource arguments in a ReadOnlyFile or MutableFile object.File::asymmetricEncrypt() and File::asymmetricDecrypt().These security improvements were identified through an internal code review after years of studying new cryptographic attacks. Halite v4 ciphertexts are still decryptable with v5, so upgrading should be largely drop-in.
final access modifier from private methods and guarantees PHP 8 support.ReadOnlyFile.Throwable.File API. Thanks [@elliot-sawyer](https://github.com/elliot-sawyer).MutableFile to be used on resources opened in wb mode. Thanks [@christiaanbaartse](christiaanbaartse).class_alias() for ParagonIE\Halite\HiddenString to the outsourced library.
This is deprecated and will be removed in version 5.^0|^1 to ^1|^2.HiddenString to a standalone library: https://travis-ci.org/paragonie/hidden-string^0|^1 to ^1.Fixes #105.
Please upgrade to Halite 4 as soon as possible. We are not providing support for older versions of Halite any more. See https://github.com/paragonie/halite/releases/tag/v3.4.0
WeakReadOnlyFile, an alternative to ReadOnlyFile that allows file modes other than rb. The TOCTOU security guarantees are therefore slightly weaker with this class (hence the "Weak" part of the name).File to allow stream objects (ReadOnlyFile and MutableFile) to be passed direclty instead of strings (for filenames) and resources (for open file handles).#72: Fixed forward-compatibility with libsodium 1.0.15.
Halite::VERSION constant which was previously still 4.2.0.SignatureKeyPair object into a birationally
equivalent EncryptionKeyPair object by invoking the getEncryptionKeyPair()
method.Asymmetric::signAndEncrypt() and Asymmetric::verifyAndDecrypt(),
which facilitates the GPG use-case of signed-then-encrypted messages between
two parties' Ed25519 keypairs. Encryption is facilitated using birationally
equivalent X25519 keys.substr and strlen in
favor of using the ones in the constant-time encoding library.Added support for libsodium 1.0.15, which was previously broken in 4.0.x.
Passwords should be autoamtically migrated, but if keys were being generated via
KeyFactory::derive______Key() (fill in the blank), you'll need to change your
usage of this API to get the same key as previously. Namely, you'll need to pass
the SODIUM_CRYPTO_PWHASH_ALG_ARGON2I13 constant to the fourth argument after the
password, salt, and security level.
$key = KeyFactory::deriveEncryptionKey(
new HiddenString('correct horse barry staple'),
- "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
+ "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
+ KeyFactory::INTERACTIVE,
+ SODIUM_CRYPTO_PWHASH_ALG_ARGON2I13
);
If you previously specified a security level, your diff might look like this:
$key = KeyFactory::deriveEncryptionKey(
new HiddenString('correct horse barry staple'),
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
- KeyFactory::SENSITIVE
+ KeyFactory::SENSITIVE,
+ SODIUM_CRYPTO_PWHASH_ALG_ARGON2I13
);
This is mostly a boyscouting/documentation release. However, we now pass Psalm under the
strictest setting (totallyTyped = true). This means that not only is our public interface
totally type-safe, but Halite's internals are as well.
Halite will attempt to use sodium_compat where ever it can. However, for best results, install version 1.0.6 of the libsodium extension from PECL.
The 1.x branch of Halite is the only version that still supports PHP 5. All future versions require PHP 7 or higher. Version 4 requires PHP 7.2.
encryptWithAd() and decryptWithAd(), for satisfying true AEAD needsPassword class can also accept an optional,
additional data parameterHiddenString objects can now be directly compared
$hiddenString->equals($otherHiddenString)How can I help you explore Laravel packages today?