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.1(5y ago)0869PHP

Since Apr 22Pushed 5y 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 3w ago

READMEChangelog (2)DependenciesVersions (3)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

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity54

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 ~0 days

Total

2

Last Release

1898d 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)")

### 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

[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k18.7M143](/packages/mews-purifier)[paragonie/ecc

PHP Elliptic Curve Cryptography library

24820.0k37](/packages/paragonie-ecc)

PHPackages © 2026

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