PHPackages                             muhammadmian/magento-2-crypt-key-replace - 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. muhammadmian/magento-2-crypt-key-replace

ActiveMagento2-module[Security](/categories/security)

muhammadmian/magento-2-crypt-key-replace
========================================

Replaces Main Crypt Key with one configured in admin

1.0.2(3w ago)0883PHP

Since Apr 22Pushed 3w ago1 watchersCompare

[ Source](https://github.com/muhammadmian/magento-2-crypt-key-replace)[ Packagist](https://packagist.org/packages/muhammadmian/magento-2-crypt-key-replace)[ RSS](/packages/muhammadmian-magento-2-crypt-key-replace/feed)WikiDiscussions main Synced yesterday

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

Magento 2 Crypt Key Replace
===========================

[](#magento-2-crypt-key-replace)

[![Releases](https://camo.githubusercontent.com/c50081f31f7deb52dccba13d50b8364a7aada6352a09a65c2e660b2ba04925ad/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6d7568616d6d61646d69616e2f6d6167656e746f2d322d63727970742d6b65792d7265706c6163652e737667)](https://github.com/muhammadmian/magento-2-crypt-key-replace/releases)

### Tested On

[](#tested-on)

- Magento 2.3
- Magento 2.4

### Problem Explained

[](#problem-explained)

If you've migrated magento from one server to another, but you cannot directly edit your env.php file to change your Crypt Key, this module will help you to do that in admin.

Magento's built in function to replace Crypt key will not work if you are still working with data that has already been encrypted with a different Crypt key.

This is because magento adds an index position of the crypt key used from the crypt key array to the encrypted data.

**E.g. Old Setup:**
Crypt Key Array:

```
[
    0 => OLD_CRYPT_KEY
]

```

Previously Encrypted Data Value: **\[0\]**:34JHSDJ3H4JHDFJH34JJHFJHDFJHDF **(SUCCESS)**

**New Setup:**
If you use Magento's built-in feature to add a new crypt key, it will be added as the 2nd index of the array.
Crypt Key Array:

```
[
    0 => NEW_CRYPT_KEY
    1 => OLD_CRYPT_KEY
]

```

Previously Encrypted Data Value: **\[0\]**:34JHSDJ3H4JHDFJH34JJHFJHDFJHDF **(FAIL)**

The index 0 (Zero) of the crypt key array is no longer the old encryption key thus it will fail to decrypt the data and give up.

### Solution

[](#solution)

This module adds the encryption key configured in magento admin as the first item in the crypt key array.

`PLEASE NOTE: Any new data encrypted with the new encryption key will not decrypt`

### How to use

[](#how-to-use)

Simply install the module using composer.
`composer require muhammadmian/magento-2-crypt-key-replace`

**Admin Config**
Set the following config to **YES** and configure your new crypt key
`Store > Configuration > Advanced > System > Enable Crypt Key Override`

Enjoy.

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance95

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~961 days

Total

3

Last Release

21d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2c333b3305b1b1166ff0199eb72dde169e1ecf7464f7b1382173835800837d4d?d=identicon)[muhammadlilg](/maintainers/muhammadlilg)

---

Top Contributors

[![makproductions](https://avatars.githubusercontent.com/u/10479146?v=4)](https://github.com/makproductions "makproductions (3 commits)")[![mmian-expertime](https://avatars.githubusercontent.com/u/89633600?v=4)](https://github.com/mmian-expertime "mmian-expertime (3 commits)")[![mmianexpertime](https://avatars.githubusercontent.com/u/89633600?v=4)](https://github.com/mmianexpertime "mmianexpertime (3 commits)")[![hkyfcdxn](https://avatars.githubusercontent.com/u/32741975?v=4)](https://github.com/hkyfcdxn "hkyfcdxn (1 commits)")

### Embed Badge

![Health badge](/badges/muhammadmian-magento-2-crypt-key-replace/health.svg)

```
[![Health](https://phpackages.com/badges/muhammadmian-magento-2-crypt-key-replace/health.svg)](https://phpackages.com/packages/muhammadmian-magento-2-crypt-key-replace)
```

###  Alternatives

[phpids/phpids

PHPIDS (PHP-Intrusion Detection System) is a simple to use, well structured, fast and state-of-the-art security layer for your PHP based web application

791150.0k2](/packages/phpids-phpids)[paragonie/ecc

PHP Elliptic Curve Cryptography library

25866.3k44](/packages/paragonie-ecc)[nicobleiler/php-passphrase

Passphrase generator with Laravel integration, inspired by Bitwarden. Uses the EFF long word list by default with support for custom wordlists.

4912.6k](/packages/nicobleiler-php-passphrase)[dwgebler/encryption

Encryption wrapper for PHP using libsodium — simple API for symmetric and asymmetric encryption, password hashing, digital signing, and message authentication.

317.5k](/packages/dwgebler-encryption)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
