Download the PHP package authcrypt/crypto-php without Composer

On this page you can find all versions of the php package authcrypt/crypto-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package crypto-php

Application‑Level Encryption for PHP


Latest Stable Version Build status Code Coverage Mutation testing badge Static analysis type-coverage

This package provides a modern, authenticated encryption layer built on AEAD ciphers. It is designed for:

Requirements

Installation

The package could be installed with Composer:

Quick Start

Cryptors

All cryptors implement CryptorInterface and are responsible for the overall encryption flow. They differ in how the data encryption key (DEK) is obtained and how the ciphertext is structured.

KdfCryptor

KDF‑based encryption (single key derived per message, no key wrapping).
A fresh Data Encryption Key (DEK) is derived from the secret and the provided context using the configured KDF. If the configured KDF requires a salt, a random salt is generated for each message and prepended to the ciphertext.

Output structure:

EnvelopeCryptor

Envelope encryption (key wrapping) using a KDF to derive a Key Encryption Key (KEK) and a random Data Encryption Key (DEK). The DEK is wrapped with the KEK and stored alongside the ciphertext. The DEK is used to encrypt the actual data.

The DEK wrap cipher can be specified separately (e.g., OpenSSLWrapCipher); if omitted, the data cipher is used for wrapping as well.

Output structure:

VersionedCryptor

Wraps multiple cryptors and adds a fixed‑length version prefix to every ciphertext.

Output structure:

Key Derivation

The package provides two HKDF‑based KDF implementations (RFC 5869), both suitable for high‑entropy secrets (random keys).

HkdfExtended

Directly applies HKDF to the input secret. Suitable when the secret is already a strong random key (32 bytes or more).

This implementation satisfies the KDF Security requirements (resistance to key extraction and key expansion attacks) as defined in the HKDF specification.

HkdfExtended supports static salt for domain separation, ensuring that keys derived for different contexts remain distinct even when the same secret is used. It also provides dynamic salt for per‑message randomness, which is enabled by default. When dynamic salt is disabled, the caller must supply a unique context for each derivation to prevent key reuse.

HkdfPlain

A simpler variant that applies HKDF without a static salt. This is suitable when you do not need additional domain separation, or when the secret itself is already adequately randomised.

When salt is disabled, the caller must supply a unique context per encryption.

Ciphers

The package provides two backends: OpenSSL and Sodium (libsodium).

SodiumAeadCipher

Uses Sodium's high‑performance AEAD ciphers. Supports the following algorithms:

Note: AES‑256‑GCM with Sodium requires CPU support for AES instructions (AES‑NI).

OpenSSLAeadCipher

Uses OpenSSL's AEAD ciphers. Supports the following algorithms:

OpenSSLWrapCipher

A dedicated cipher for key wrapping (RFC 5649 AES‑KW). This cipher should only be used inside EnvelopeCryptor for wrapping DEKs, not for general‑purpose encryption. Allowed algorithms:

Examples

User data encryption

Use this when each entity (user, record, document) has a natural unique identifier. The context includes that identifier, so no dynamic salt is needed, making the ciphertext shorter.

Static context encryption

Use this when data does not have a natural unique identifier. The dynamic salt provides per‑message randomness.

Envelope encryption for long‑term storage

Use EnvelopeCryptor when you may need to rotate the master key without re‑encrypting all data. The DEK is independent of the master key – only the wrapped DEK needs to be re‑encrypted.

Algorithm Migration with VersionedCryptor

Gradually upgrade encryption algorithms while keeping old ciphertexts readable.

Documentation

License

MIT


All versions of crypto-php with dependencies

PHP Build Version
Package Version
Requires php Version 8.2 - 8.5
ext-hash Version *
ext-mbstring Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package authcrypt/crypto-php contains the following files

Loading the files please wait ...