insitaction / field-encrypt-bundle
允许自动加密字段,满足GDPR要求。
3.0.5
2023-12-04 10:19 UTC
Requires
- php: >=8.2
- ext-openssl: *
- doctrine/orm: ^2.16
- symfony/framework-bundle: ^6.0|^7.0
- symfony/html-sanitizer: ^6.0|^7.0
- symfony/polyfill-php80: ^1.28
- symfony/property-access: ^6.0|^7.0
This package is auto-updated.
Last update: 2024-09-04 14:31:48 UTC
README
字段加密
字段加密是一个symfony bundle,允许根据GDPR要求在数据库中加密字段。
安装
composer require insitaction/field-encrypt-bundle
环境
您必须在.env文件中定义ENCRYPT_KEY变量。
ENCRYPT_KEY必须是一个aes-256-cbc密钥,前32个字符。
使用方法
您必须将EncryptedString::ENCRYPTED_STRING类型属性添加到您想要加密/解密的字段中。
让我们看一个例子
<?php namespace App\Entity; use Doctrine\ORM\Mapping as ORM; use Insitaction\FieldEncryptBundle\Doctrine\DBAL\Types\EncryptedString; class MyEntity { #[ORM\Column(type: EncryptedString::ENCRYPTED_STRING, unique: true)] private mixed $myPrivateEncryptedField; #[ORM\Column(type: 'string', unique: true)] private string $email; public function getUniqueIdentifier(): string { return $this->email; } }
这就是 else !