Skip to content

Commit 464901d

Browse files
Moussa Sidibesidibos
authored andcommitted
SDK-603: Amend the anchorConverter to only look for known Oids
1 parent dbab96b commit 464901d

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

src/Yoti/Util/Profile/AnchorConverter.php

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,16 @@ public static function convert(Anchor $protobufAnchor)
2828
$anchorTypesMap = self::getAnchorTypesMap();
2929

3030
foreach ($X509CertsList as $certX509Obj) {
31-
$certExtArr = $certX509Obj->tbsCertificate->extensions;
32-
33-
foreach($anchorTypesMap as $oid => $anchorType)
34-
{
35-
foreach($certExtArr as $extObj) {
36-
$extRaw = (array) $extObj;
37-
$oidFound = array_search($oid, $extRaw, TRUE);
38-
if ($oidFound !== FALSE) {
39-
$extEncodedValue = $extRaw['extnValue'];
40-
41-
if (
42-
is_string($extEncodedValue)
43-
&& ($decodedAnchorValue = self::decodeAnchorValue($ASN1, $X509, $extEncodedValue))
44-
) {
31+
$certExtsArr = $certX509Obj->tbsCertificate->extensions;
32+
33+
foreach($anchorTypesMap as $oid => $anchorType) {
34+
foreach($certExtsArr as $extObj) {
35+
$extArr = (array) $extObj;
36+
$oidFound = array_search($oid, $extArr, TRUE);
37+
if ($oidFound !== FALSE && is_string($extArr['extnValue'])) {
38+
$extEncodedValue = $extArr['extnValue'];
39+
40+
if ($decodedAnchorValue = self::decodeAnchorValue($ASN1, $X509, $extEncodedValue)) {
4541
$yotiAnchor = self::createYotiAnchor(
4642
$decodedAnchorValue,
4743
$anchorType,
@@ -54,7 +50,7 @@ public static function convert(Anchor $protobufAnchor)
5450
'yoti_anchor' => $yotiAnchor
5551
];
5652
// We are only looking for one YotiAnchor from protobufAnchor
57-
break;
53+
return $anchorMap;
5854
}
5955
}
6056
}

0 commit comments

Comments
 (0)