Download the PHP package tezmanian/utils-crypto without Composer

On this page you can find all versions of the php package tezmanian/utils-crypto. 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 utils-crypto

tez-utils-crypto

CI Packagist Version PHP

Authenticated AES-GCM encryption for PHP — supports AES-128/192/256-GCM with random nonces, tag verification, and a strict enum-based cipher allowlist. PHP 8.3+, requires ext-openssl.

Installation

Package: tezmanian/utils-crypto · Namespace: Tezmanian\Utils\Crypto

Components

Class Purpose
AesEncryptionService Encrypts and decrypts strings using authenticated AES-GCM
AesCipher Enum allowlist of supported cipher variants with their parameters

Encrypted format

A fresh random nonce is generated on every encrypt() call — identical plaintexts produce different ciphertexts. The GCM authentication tag is verified on decrypt(), so tampered data is always rejected.


Quick start


AesEncryptionService

Constructor

Parameter Description
$hexKey Hex-encoded key — length must match the chosen cipher (see table below)
$cipher Cipher variant — defaults to AesCipher::Aes256Gcm

Throws InvalidArgumentException when the key length does not match the cipher.

Methods

decrypt() throws RuntimeException on invalid base64, too-short input, or authentication tag mismatch.


AesCipher

Enum acting as an explicit allowlist — only ciphers defined here may be used.

Case OpenSSL string Key length Hex key chars
AesCipher::Aes128Gcm aes-128-gcm 16 bytes / 128 bit 32
AesCipher::Aes192Gcm aes-192-gcm 24 bytes / 192 bit 48
AesCipher::Aes256Gcm aes-256-gcm 32 bytes / 256 bit 64 (recommended)

All variants use a 12-byte nonce (NIST-recommended) and a 16-byte authentication tag.


Selecting a cipher variant


Error handling


Requirements

Development

License

MIT — see LICENSE.

Author: René Halberstadt


All versions of utils-crypto with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
ext-openssl Version *
tezmanian/utils-enum Version ^1.0
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 tezmanian/utils-crypto contains the following files

Loading the files please wait ...