Halite is a high-level cryptography interface that relies on libsodium for all of its underlying cryptography operations.
Halite was created by Paragon Initiative Enterprises as a result of our continued efforts to improve the ecosystem and make cryptography in PHP safer and easier to implement.
It's released under the GPLv3 license. Commercial licenses are available from Paragon Initiative Enterprises if you wish to implement Halite in an application without making your source code available under a GPL-compatible license.
- Install Libsodium and the PHP Extension
composer require paragonie/halite
Check out the documentation. The basic Halite API is designed for simplicity:
- Encryption
- Symmetric
Symmetric\Crypto::encrypt
(string
,EncryptionKey
,bool?
):string
Symmetric\Crypto::decrypt
(string
,EncryptionKey
,bool?
):string
- Asymmetric
- Anonymous
Asymmetric\Crypto::seal
(string
,EncryptionPublicKey
,bool?
):string
Asymmetric\Crypto::unseal
(string
,EncryptionSecretKey
,bool?
):string
- Authenticated
Asymmetric\Crypto::encrypt
(string
,EncryptionSecretKey
,EncryptionPublicKey
,bool?
):string
Asymmetric\Crypto::decrypt
(string
,EncryptionSecretKey
,EncryptionPublicKey
,bool?
):string
- Anonymous
- Symmetric
- Authentication
- Symmetric
Symmetric\Crypto::authenticate
(string
,AuthenticationKey
,bool?
):string
Symmetric\Crypto::verify
(string
,AuthenticationKey
,string
,bool?
):bool
- Asymmetric
Asymmetric\Crypto::sign
(string
,SignatureSecretKey
,bool?
):string
Asymmetric\Crypto::verify
(string
,SignaturePublicKey
,string
,bool?
):bool
- Symmetric