1

I encrypt code id using below code

$this->_encryptor->encrypt($quote->getId())

when I decrypt with below code

$this->_encryptor->decrypt($quoteId);

It is not getting real value for some problem of special character.

1

please try this code and check it's working or not

$this->_encryptor->encrypt((int)$quote->getId())

also try this code

        $this->_dataSaveAllowed = false;
        $value = (int)$quote->getId();
        // don't save value, if an obscured value was received. This indicates that data was not changed.
        if (!preg_match('/^\*+$/', $value) && !empty($value)) {
            $this->_dataSaveAllowed = true;
            $encrypted = $this->_encryptor->encrypt($value);
            $this->setValue($encrypted);
        } elseif (empty($value)) {
            $this->_dataSaveAllowed = true;
        }

        $this->_encryptor->decrypt($value);
  • no ites not work for me. – Jigs Parmar Oct 26 '17 at 2:47
  • some times its work like for value 5 its work but for vlaue 6 its not work – Jigs Parmar Oct 26 '17 at 2:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.