insitaction/field-encrypt-bundle

允许自动加密字段,满足GDPR要求。

安装数: 4,907

依赖项: 0

建议者: 0

安全性: 0

星标: 5

关注者: 1

分支: 0

类型:symfony-bundle

3.0.5 2023-12-04 10:19 UTC

This package is auto-updated.

Last update: 2024-09-04 14:31:48 UTC


README

Insitaction

字段加密

字段加密是一个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 !