定制 precision-soft/symfony-doctrine-encrypt 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

precision-soft/symfony-doctrine-encrypt

最新稳定版本:v2.1.0

Composer 安装命令:

composer require precision-soft/symfony-doctrine-encrypt

包简介

doctrine encrypt type

README 文档

README

The bundle will automatically register the types from \PrecisionSoft\Doctrine\Encrypt\Type as Doctrine types.

It can be used for any string field.

You may fork and modify it as you wish.

Contributions are welcomed.

Purpose

Encrypt and decrypt data using Doctrine.

I am trying to solve a few problems that i found with the current offerings:

  • Have encrypt and decrypt available if using entities or just selecting fields.
  • Easy where (for the moment the parameters have to be encrypted before setting them).

Usage

  • The value on the entity will always be unencrypted.
  • The purpose for AES256FixedEncryptor, AES256FixedType pair is to be able to use WHERE, as it will always return the same result for the same input.
  • EntityService::getEncryptor() will return the encryptor used for the field, if you need to encrypt a value to use it as a WHERE parameter.
  • Inside entity:
class Customer
{
    /**
     * @ORM\Column(type="encryptedAES256")
     */
    private string $name;

    public function getName(): ?string
    {
        return $this->name;
    }

    public function setName(string $name): self
    {
        $this->name = $name;

        return $this;
    }
}
  • To encrypt an unencrypted database:
php bin/console precision-soft:doctrine:database:encrypt
  • To decrypt an encrypted database:
php bin/console precision-soft:doctrine:database:decrypt

Dev

git clone git@gitlab.com:precision-soft-open-source/symfony/doctrine-encrypt.git
cd doctrine-encrypt

./dc build && ./dc up -d

Todo

  • Easy where, pass the unencrypted params and have them automatically encrypt.
  • Configure registered encryptors.
  • Have a isEncrypted($entity, $fieldName): bool method.
  • Unit tests.

Inspired by

统计信息

  • 总下载量: 27
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-09-17