Skip to content

Encrypted string with aes_binary_cryptor doesn't match with previous encrypted string #14

@diegodurrod

Description

@diegodurrod

Problem

Encrypted string with aes_binary_cryptor never matches with the same string previously encrypted with the same encryptor.

Current configuration

gtt_crypt:
    cryptors:
        aes:
            aes_binary_cryptor:
                key_size: 256
                key_path: "%kernel.project_dir%/config/aes/first.key"
                binary_output: true
    doctrine:
        dbal:
            encrypted_string: aes_binary_cryptor

How to simulate the problem

$string1 = $this->crypt->encrypt('abc');
$string2 = $this->crypt->encrypt('abc');

// $string1 never matches with $string2!

How I'm applying it in a repository method

$qb = $this->createQueryBuilder('q');
$qb->andWhere('q.name = :name');
$qb->setParameter('name', $name, TypeEnum::ENCRYPTED_STRING);

$query = $qb->getQuery();
return $query->execute();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions