PHPackages                             brainfoolong/cryptojs-aes-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. brainfoolong/cryptojs-aes-php

Abandoned → [brainfoolong/js-aes-php](/?search=brainfoolong%2Fjs-aes-php)ArchivedLibrary[Security](/categories/security)

brainfoolong/cryptojs-aes-php
=============================

CryptoJS AES encryption/decryption on client side with Javascript and on server side with PHP

2.3.0(2y ago)399312.3k—5.2%1553MITPHPPHP &gt;=7.0.0

Since Dec 30Pushed 1y ago28 watchersCompare

[ Source](https://github.com/brainfoolong/cryptojs-aes-php)[ Packagist](https://packagist.org/packages/brainfoolong/cryptojs-aes-php)[ Docs](https://github.com/brainfoolong/cryptojs-aes-php)[ GitHub Sponsors](https://github.com/brainfoolong)[ RSS](/packages/brainfoolong-cryptojs-aes-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)DependenciesVersions (5)Used By (3)

CryptoJS AES encryption/decryption on client side with Javascript and on server side with PHP
=============================================================================================

[](#cryptojs-aes-encryptiondecryption-on-client-side-with-javascript-and-on-server-side-with-php)

[![Tests](https://github.com/brainfoolong/cryptojs-aes-php/actions/workflows/tests.yml/badge.svg)](https://github.com/brainfoolong/cryptojs-aes-php/actions/workflows/tests.yml)

Important

This library is considered deprecated, read-only and superseeded by my newer library  - It's basically the same without the need for the third party library `CryptoJS`.

A tool to AES encrypt/decrypt data in javascript and/or PHP. You can use it for PHP only, for Javascript only or mix it together.

It uses default `aes-256-cbc` implementation with random salts and random initialization vector. This library does not support other ciphers or modes.

Features
--------

[](#features)

- Encrypt any value in Javascript (objects/array/etc...) - Everything that can be passed to `JSON.stringify`
- Encrypt any value in PHP (object/array/etc...) - Everything that can be passed to `json_encode`
- Decrypt in PHP/Javascript, doesn't matter where you have encrypted the values

How to use
----------

[](#how-to-use)

###### PHP | See [dist/example-php.php](https://github.com/brainfoolong/cryptojs-aes-php/blob/master/dist/example-php.php)

[](#php--see-distexample-phpphp)

You need the file `src/CryptoJsAes.php`

```
