Rev 979 | Rev 1052 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 979 | Rev 1050 | ||
---|---|---|---|
Line 15... | Line 15... | ||
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
16 | * See the License for the specific language governing permissions and |
16 | * See the License for the specific language governing permissions and |
17 | * limitations under the License. |
17 | * limitations under the License. |
18 | */ |
18 | */ |
19 | 19 | ||
20 | if (!defined('INSIDE_OIDPLUS')) die(); |
20 | namespace ViaThinkSoft\OIDplus; |
21 | 21 | ||
22 | class OIDplusOid extends OIDplusObject { |
22 | class OIDplusOid extends OIDplusObject { |
23 | private $oid; |
23 | private $oid; |
24 | 24 | ||
25 | public function __construct($oid) { |
25 | public function __construct($oid) { |
Line 118... | Line 118... | ||
118 | $tmp = str_replace(explode(' ', $tmp, 2)[0], '<a href="https://weid.info/" target="_blank">'.explode(' ', $tmp, 2)[0].'</a>', $tmp); |
118 | $tmp = str_replace(explode(' ', $tmp, 2)[0], '<a href="https://weid.info/" target="_blank">'.explode(' ', $tmp, 2)[0].'</a>', $tmp); |
119 | $tech_info[$tmp] = $this->getWeidNotation(); |
119 | $tech_info[$tmp] = $this->getWeidNotation(); |
120 | 120 | ||
121 | $tmp = _L('DER encoding'); |
121 | $tmp = _L('DER encoding'); |
122 | $tmp = str_replace(explode(' ', $tmp, 2)[0], '<a href="https://misc.daniel-marschall.de/asn.1/oid-converter/online.php" target="_blank">'.explode(' ', $tmp, 2)[0].'</a>', $tmp); |
122 | $tmp = str_replace(explode(' ', $tmp, 2)[0], '<a href="https://misc.daniel-marschall.de/asn.1/oid-converter/online.php" target="_blank">'.explode(' ', $tmp, 2)[0].'</a>', $tmp); |
123 | $tech_info[$tmp] = str_replace(' ', ':', OidDerConverter::hexarrayToStr(OidDerConverter::oidToDER($this->nodeId(false)))); |
123 | $tech_info[$tmp] = str_replace(' ', ':', \OidDerConverter::hexarrayToStr(\OidDerConverter::oidToDER($this->nodeId(false)))); |
124 | 124 | ||
125 | return $tech_info; |
125 | return $tech_info; |
126 | } |
126 | } |
127 | 127 | ||
128 | protected function isClassCWeid() { |
128 | protected function isClassCWeid() { |
Line 192... | Line 192... | ||
192 | // Gets the last arc of an WEID |
192 | // Gets the last arc of an WEID |
193 | public function weidArc() { |
193 | public function weidArc() { |
194 | // Dirty hack: We prepend '0.' in front of the OID to enforce the |
194 | // Dirty hack: We prepend '0.' in front of the OID to enforce the |
195 | // creation of a Class A weid (weid:root:) . Otherwise we could not |
195 | // creation of a Class A weid (weid:root:) . Otherwise we could not |
196 | // get the hidden arc value "8" from "weid:4" (which is actually "weid:pen:SZ5-8-?" |
196 | // get the hidden arc value "8" from "weid:4" (which is actually "weid:pen:SZ5-8-?" |
197 | $weid = WeidOidConverter::oid2weid('0.'.$this->getDotNotation()); |
197 | $weid = \Frdl\Weid\WeidOidConverter::oid2weid('0.'.$this->getDotNotation()); |
198 | if ($weid === false) return false; |
198 | if ($weid === false) return false; |
199 | $ary = explode(':', $weid); |
199 | $ary = explode(':', $weid); |
200 | $weid = array_pop($ary); // remove namespace and sub-namespace if existing |
200 | $weid = array_pop($ary); // remove namespace and sub-namespace if existing |
201 | $x = explode('-', $weid); |
201 | $x = explode('-', $weid); |
202 | if (count($x) < 2) return ''; // WEID root arc. Has no name |
202 | if (count($x) < 2) return ''; // WEID root arc. Has no name |
203 | return $x[count($x)-2]; |
203 | return $x[count($x)-2]; |
204 | } |
204 | } |
205 | 205 | ||
206 | public function getWeidNotation($withAbbr=true) { |
206 | public function getWeidNotation($withAbbr=true) { |
207 | $weid = WeidOidConverter::oid2weid($this->getDotNotation()); |
207 | $weid = \Frdl\Weid\WeidOidConverter::oid2weid($this->getDotNotation()); |
208 | if ($withAbbr) { |
208 | if ($withAbbr) { |
209 | $ary = explode(':', $weid); |
209 | $ary = explode(':', $weid); |
210 | $weid = array_pop($ary); // remove namespace and sub-namespace if existing |
210 | $weid = array_pop($ary); // remove namespace and sub-namespace if existing |
211 | $ns = implode(':', $ary).':'; |
211 | $ns = implode(':', $ary).':'; |
212 | 212 | ||
Line 529... | Line 529... | ||
529 | if ($aid_is_ok) $ids[] = new OIDplusAltId('aid', $aid, _L('Application Identifier (ISO/IEC 7816)'), ' ('._L('Optional PIX allowed, with "FF" prefix').')'); |
529 | if ($aid_is_ok) $ids[] = new OIDplusAltId('aid', $aid, _L('Application Identifier (ISO/IEC 7816)'), ' ('._L('Optional PIX allowed, with "FF" prefix').')'); |
530 | } |
530 | } |
531 | 531 | ||
532 | // (VTS F6) Mapping OID-to-AID if possible |
532 | // (VTS F6) Mapping OID-to-AID if possible |
533 | try { |
533 | try { |
534 | $test_der = OidDerConverter::hexarrayToStr(OidDerConverter::oidToDER($this->nodeId(false))); |
534 | $test_der = \OidDerConverter::hexarrayToStr(\OidDerConverter::oidToDER($this->nodeId(false))); |
535 | } catch (Exception $e) { |
535 | } catch (\Exception $e) { |
536 | $test_der = '00'; // error, should not happen |
536 | $test_der = '00'; // error, should not happen |
537 | } |
537 | } |
538 | if (substr($test_der,0,3) == '06 ') { // 06 = ASN.1 type of Absolute ID |
538 | if (substr($test_der,0,3) == '06 ') { // 06 = ASN.1 type of Absolute ID |
539 | $oid_parts = explode('.',$this->nodeId(false)); |
539 | $oid_parts = explode('.',$this->nodeId(false)); |
540 | if (($oid_parts[0] == '2') && ($oid_parts[1] == '999')) { |
540 | if (($oid_parts[0] == '2') && ($oid_parts[1] == '999')) { |