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)0867PHP

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 today

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 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% of commits — single point of failure

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

1844d 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)")[![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

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M214](/packages/defuse-php-encryption)[roave/security-advisories

Prevents installation of composer packages with known security vulnerabilities: no API, simply require it

2.9k97.3M6.4k](/packages/roave-security-advisories)[mews/purifier

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

2.0k16.7M113](/packages/mews-purifier)[robrichards/xmlseclibs

A PHP library for XML Security

41278.1M118](/packages/robrichards-xmlseclibs)[bjeavons/zxcvbn-php

Realistic password strength estimation PHP library based on Zxcvbn JS

86917.5M63](/packages/bjeavons-zxcvbn-php)[enlightn/security-checker

A PHP dependency vulnerabilities scanner based on the Security Advisories Database.

33732.2M110](/packages/enlightn-security-checker)

PHPackages © 2026

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