Download the PHP package ilicmiljan/secure-props without Composer

On this page you can find all versions of the php package ilicmiljan/secure-props. 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 secure-props

SecureProps - PHP Encryption Library

stability-mature GitHub Workflow Status (with branch) codecov Packagist PHP Version GitHub

SecureProps is a powerful PHP library designed to simplify the encryption and decryption of property data in objects.

Utilizing the power of PHP attributes, SecureProps allows developers to easily secure sensitive data within their applications. The library supports both asymmetric and symmetric encryption methods, providing flexibility in securing your application data.

Features

Requirements

Installation

You can install SecureProps via Composer by running the following command:

Ensure that your composer.json file is updated and the library is included in your project's dependencies.

Usage

Marking Properties for Encryption

Use the #[Encrypted] attribute to mark properties for encryption. This attribute supports an optional placeholder parameter for customizable decryption failure handling.

When decryption fails, and a placeholder is provided, that value is used instead. If the placeholder is null, an exception may be thrown.

Encrypting and Decrypting Objects

To encrypt or decrypt objects, you will need to use the ObjectEncryptionService. Here is an example:

Asymmetric Encryption

To use asymmetric encryption, initialize the AsymmetricEncryptionCipher with your public and private keys:

Tagged Encryption

When working with objects that have properties with both encrypted and non-encrypted values, the TagAwareCipher provides an advanced solution. This cipher allows for targeted decryption, operating only on encrypted and tagged properties, which prevents errors when encountering non-encrypted data.

How It Works

TagAwareCipher automatically tags encrypted data with <ENC> and </ENC>, making it distinctly identifiable. It specifically looks for these tags during the decryption process to determine which data to decrypt. This targeted approach means that if an object contains tagged (encrypted) and untagged (plain) data, TagAwareCipher will only attempt to decrypt the tagged portions.

This avoids the risk of exceptions that typically occur when trying to decrypt data that isn't encrypted, ensuring error-free processing.

[!IMPORTANT] When using TagAwareCipher for decryption, it's crucial to understand that it will only decrypt data wrapped with <ENC> and </ENC> tags.

If it encounters encrypted data without these tags, the decryption process will skip it, and the data will be returned in its encrypted form.

Here is an example:

Property Readers

SecureProps provides two types of property readers to handle encrypted properties within your PHP objects efficiently: RuntimeObjectPropertiesReader and CachingObjectPropertiesReader.

RuntimeObjectPropertiesReader

The RuntimeObjectPropertiesReader dynamically examines objects at runtime to identify properties decorated with the #[Encrypted] attribute. Utilizing PHP's reflection requires no additional setup for caching and offers straightforward inspection capabilities.

CachingObjectPropertiesReader

For enhanced performance, especially in applications that frequently deal with the same types of objects, the CachingObjectPropertiesReader caches property reading results. This approach reduces the computational overhead associated with reflection.

It integrates seamlessly with PSR-6 compliant caching solutions, allowing for customizable performance optimization.

Quick Start Example

Combining CachingObjectPropertiesReader with RuntimeObjectPropertiesReader and a PSR-6 compliant cache implementation:

Encoders

Encoders are crucial components in the encryption and decryption process, transforming data into a format suitable for secure transmission or storage and then back to its original form.

Base64Encoder

The Base64Encoder is designed for encoding binary data into a string of ASCII characters, using the Base64 encoding scheme. This makes the data safe for transmission over protocols that are not binary-safe.

NullEncoder

The NullEncoder serves as a pass-through, meaning it does not alter the input data. This is particularly useful when you want to avoid double-encoding data that is already in a suitable format for storage or when the encoding process is managed elsewhere.

Quick Start Example

In the context of initializing the AdvancedEncryptionStandardCipher with AES encryption, you can optionally attach a custom encoder.

[!NOTE]
Unless specified otherwise, all ciphers use Base64Encoder as the default encoder to ensure the encrypted data is binary-safe and suitable for transmission or storage across different systems.

Contributing

Contributions to SecureProps are welcome. Please ensure that your code adheres to the project's coding standards and include tests for new features or bug fixes.

License

SecureProps is open-sourced software licensed under the MIT license.


All versions of secure-props with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
ext-openssl Version *
psr/cache Version ^1.0|^2.0|^3.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 ilicmiljan/secure-props contains the following files

Loading the files please wait ....