Skip to content

Commit 67caeb3

Browse files
committed
"null request body check"
1 parent dd6292e commit 67caeb3

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/Authentication/Util/MLEUtility.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ public static function checkIsMLEForAPI($merchantConfig, $isMLESupportedByCybsFo
5050

5151
public static function encryptRequestPayload($merchantConfig, $requestBody)
5252
{
53+
if ($requestBody === null || $requestBody === '') {
54+
return $requestBody;
55+
}
5356
if (self::$logger === null) {
5457
self::$logger = (new LogFactory())->getLogger(\CyberSource\Utilities\Helpers\ClassHelper::getClassName(get_class()), $merchantConfig->getLogConfiguration());
5558
}
@@ -132,7 +135,6 @@ public static function getMLECert($merchantConfig)
132135

133136
if ($x509Cert) {
134137
self::validateCertificateExpiry($x509Cert, $merchantConfig->getMleKeyAlias());
135-
// throw new MLEException("Certificate with MLE alias $keyAlias is expired.");
136138
return $x509Cert;
137139
} else {
138140
throw new MLEException("Certificate with alias " . $merchantConfig->getMleKeyAlias() . " not found");

lib/Authentication/Util/Utility.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class Utility
77

88
public static function findCertByAlias($certs, $keyAlias)
99
{
10+
$keyAlias = trim($keyAlias);
1011
if (isset($certs['cert'])) {
1112
$certData = openssl_x509_parse($certs['cert'], 1);
1213
if (isset($certData['subject']['CN']) && $certData['subject']['CN'] === $keyAlias) {

0 commit comments

Comments
 (0)