Skip to content

Commit

Permalink
SDK-2265 anchor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmet-yoti committed Jun 13, 2024
1 parent 4e2beb0 commit fb57255
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Profile/Util/Attribute/AnchorConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ private static function convertCertToX509(string $certificate): \stdClass
}
});

$decodedX509Data = Json::decode(Json::encode($X509Data), false);

//$decodedX509Data = Json::decode(Json::encode($X509Data), false);
$decodedX509Data = Json::decode(Json::encode(Json::convert_from_latin1_to_utf8_recursively($X509Data)), false);
// Ensure serial number is cast to string.
// @see \phpseclib\Math\BigInteger::__toString()
$decodedX509Data
Expand Down
18 changes: 18 additions & 0 deletions src/Util/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,22 @@ private static function validate(): void
throw new JsonException(json_last_error_msg(), json_last_error());
}
}

public static function convert_from_latin1_to_utf8_recursively($dat)
{
if (is_string($dat)) {
return utf8_encode($dat);
} elseif (is_array($dat)) {
$ret = [];
foreach ($dat as $i => $d) $ret[ $i ] = self::convert_from_latin1_to_utf8_recursively($d);

return $ret;
} elseif (is_object($dat)) {
foreach ($dat as $i => $d) $dat->$i = self::convert_from_latin1_to_utf8_recursively($d);

return $dat;
} else {
return $dat;
}
}
}

0 comments on commit fb57255

Please sign in to comment.