protected function decryptData($obj, $default = null)
    {
        if (is_null($this->cryptokey)) {
            throw InvalidSetupException::nullSecret();
        }
        if (! isset($obj->nonce)) {
            return $default;
        }
        if (! isset($obj->ciphertext)) {
            return $default;
        }
        if ($this->aesgcm) {
            try {
                $serialized = sodium_crypto_aead_aes256gcm_decrypt(
                    $obj->ciphertext,
                    $obj->nonce,
                    $obj->nonce,
                    $this->cryptokey
                );
            } catch (\Error $e) {
                error_log($e->getMessage());
                return $default;
            }
        } else {
            try {
                $serialized = sodium_crypto_aead_chacha20poly1305_ietf_decrypt(
                    $obj->ciphertext,
                    $obj->nonce,
                    $obj->nonce,
                    $this->cryptokey
                );
            } catch (\Error $e) {
                error_log($e->getMessage());
                return $default;
            }
        }
        if ($serialized === false) {
            return $default;
        }
        try {
            $value = unserialize($serialized);
        } catch (\Error $e) {
            error_log($e->getMessage());
            return $default;
        }
        sodium_memzero($serialized);
        return $value;
    }
protected function decryptData($obj, $default = null)
    {
        if (is_null($this->cryptokey)) {
            throw InvalidSetupException::nullSecret();
        }
        if (! isset($obj->nonce)) {
            return $default;
        }
        if (! isset($obj->ciphertext)) {
            return $default;
        }
        if ($this->aesgcm) {
            try {
                $serialized = sodium_crypto_aead_aes256gcm_decrypt(
                    $obj->ciphertext,
                    $obj->nonce,
                    $obj->nonce,
                    $this->cryptokey
                );
            } catch (\Error $e) {
                error_log($e->getMessage());
                return $default;
            }
        } else {
            try {
                $serialized = sodium_crypto_aead_chacha20poly1305_ietf_decrypt(
                    $obj->ciphertext,
                    $obj->nonce,
                    $obj->nonce,
                    $this->cryptokey
                );
            } catch (\Error $e) {
                error_log($e->getMessage());
                return $default;
            }
        }
        if ($serialized === false) {
            return $default;
        }
        try {
            $value = unserialize($serialized);
        } catch (\Error $e) {
            error_log($e->getMessage());
            return $default;
        }
        sodium_memzero($serialized);
        return $value;
    }
protected function decryptData ( $ obj , $ default = null ) { if ( is_null ( $ this -> cryptokey ) ) { throw InvalidSetupException :: nullSecret ( ) ; } if ( ! isset ( $ obj -> nonce ) ) { return $ default ; } if ( ! isset ( $ obj -> ciphertext ) ) { return $ default ; } if ( $ this -> aesgcm ) { try { $ serialized = sodium_crypto_aead_aes256gcm_decrypt ( $ obj -> ciphertext , $ obj -> nonce , $ obj -> nonce , $ this -> cryptokey ) ; } catch ( \ Error $ e ) { error_log ( $ e -> getMessage ( ) ) ; return $ default ; } } else { try { $ serialized = sodium_crypto_aead_chacha20poly1305_ietf_decrypt ( $ obj -> ciphertext , $ obj -> nonce , $ obj -> nonce , $ this -> cryptokey ) ; } catch ( \ Error $ e ) { error_log ( $ e -> getMessage ( ) ) ; return $ default ; } } if ( $ serialized === false ) { return $ default ; } try { $ value = unserialize ( $ serialized ) ; } catch ( \ Error $ e ) { error_log ( $ e -> getMessage ( ) ) ; return $ default ; } sodium_memzero ( $ serialized ) ; return $ value ; }
Returns the decrypted data retried from the APCu cache.

@param object $obj     The object containing the nonce and cyphertext.
@param mixed  $default Always return the default if there is a problem decrypting the
the cyphertext so failure acts like a cache miss.

@return mixed The decrypted data, or the default if decrypt failed.
Returns the decrypted data retried from the APCu cache .