if (!empty($fields)) {
curl_setopt($ch, CURLOPT_POST, true);
+
if (is_array($fields)) {
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($fields));
}
$aes = $factory->getBlockCipher('rijndael-128');
$aes->setKey($key);
$mode = $factory->getMode('ccm', $aes, $iv, [ 'adata' => $adata, 'lSize' => 7]);
-
$mode->decrypt($enc);
return $mode->finish();
if (PHP_VERSION_ID >= 70100) {
$tag = null;
$encdata = openssl_encrypt($data, 'aes-128-ccm', $key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, $iv, $tag, $adata, 8);
+
return bin2hex($encdata . $tag);
}
else {
$aes->setKey($key);
$mode = $factory->getMode('ccm', $aes, $iv, [ 'adata' => $adata, 'lSize' => 7]);
$mode->encrypt($data);
- var_dump(bin2hex($mode->finish()));
+
return bin2hex($mode->finish());
}
}