Subversion Repositories oidplus

Rev

Rev 1077 | Rev 1079 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1077 Rev 1078
Line 506... Line 506...
506
                        // You could theoretically also do this to an UUID-OID, but we exclude this case to avoid that users are confused
506
                        // You could theoretically also do this to an UUID-OID, but we exclude this case to avoid that users are confused
507
                        $ids[] = new OIDplusAltId('guid', gen_uuid_md5_namebased(UUID_NAMEBASED_NS_OID, $this->oid), _L('Name based version 3 / MD5 UUID with namespace %1','UUID_NAMEBASED_NS_OID'));
507
                        $ids[] = new OIDplusAltId('guid', gen_uuid_md5_namebased(UUID_NAMEBASED_NS_OID, $this->oid), _L('Name based version 3 / MD5 UUID with namespace %1','UUID_NAMEBASED_NS_OID'));
508
                        $ids[] = new OIDplusAltId('guid', gen_uuid_sha1_namebased(UUID_NAMEBASED_NS_OID, $this->oid), _L('Name based version 5 / SHA1 UUID with namespace %1','UUID_NAMEBASED_NS_OID'));
508
                        $ids[] = new OIDplusAltId('guid', gen_uuid_sha1_namebased(UUID_NAMEBASED_NS_OID, $this->oid), _L('Name based version 5 / SHA1 UUID with namespace %1','UUID_NAMEBASED_NS_OID'));
509
                }
509
                }
510
 
510
 
-
 
511
                $oid_parts = explode('.',$this->nodeId(false));
-
 
512
 
511
                // (VTS B1) Members
513
                // (VTS B1) Members
512
                if ($this->nodeId(false) == '1.3.6.1.4.1.37476.1') {
514
                if ($this->nodeId(false) == '1.3.6.1.4.1.37476.1') {
513
                        $aid = 'D276000186B1';
515
                        $aid = 'D276000186B1';
514
                        $aid_is_ok = aid_canonize($aid);
516
                        $aid_is_ok = aid_canonize($aid);
515
                        if ($aid_is_ok) $ids[] = new OIDplusAltId('aid', $aid, _L('Application Identifier (ISO/IEC 7816)'), ' ('._L('No PIX allowed').')');
517
                        if ($aid_is_ok) $ids[] = new OIDplusAltId('aid', $aid, _L('Application Identifier (ISO/IEC 7816)'), ' ('._L('No PIX allowed').')');
516
                } else {
518
                } else {
517
                        $oid_parts = explode('.',$this->nodeId(false));
-
 
518
                        if ((count($oid_parts) == 9) && ($oid_parts[0] == '1') && ($oid_parts[1] == '3') && ($oid_parts[2] == '6') && ($oid_parts[3] == '1') && ($oid_parts[4] == '4') && ($oid_parts[5] == '1') && ($oid_parts[6] == '37476') && ($oid_parts[7] == '1')) {
519
                        if ((count($oid_parts) == 9) && ($oid_parts[0] == '1') && ($oid_parts[1] == '3') && ($oid_parts[2] == '6') && ($oid_parts[3] == '1') && ($oid_parts[4] == '4') && ($oid_parts[5] == '1') && ($oid_parts[6] == '37476') && ($oid_parts[7] == '1')) {
519
                                $number = str_pad($oid_parts[8],4,'0',STR_PAD_LEFT);
520
                                $number = str_pad($oid_parts[8],4,'0',STR_PAD_LEFT);
520
                                $aid = 'D276000186B1'.$number;
521
                                $aid = 'D276000186B1'.$number;
521
                                $aid_is_ok = aid_canonize($aid);
522
                                $aid_is_ok = aid_canonize($aid);
522
                                if ($aid_is_ok) $ids[] = new OIDplusAltId('aid', $aid, _L('Application Identifier (ISO/IEC 7816)'), ' ('._L('Optional PIX allowed').')');
523
                                if ($aid_is_ok) $ids[] = new OIDplusAltId('aid', $aid, _L('Application Identifier (ISO/IEC 7816)'), ' ('._L('Optional PIX allowed').')');
Line 527... Line 528...
527
                if ($this->nodeId(false) == '1.3.6.1.4.1.37476.2') {
528
                if ($this->nodeId(false) == '1.3.6.1.4.1.37476.2') {
528
                        $aid = 'D276000186B2';
529
                        $aid = 'D276000186B2';
529
                        $aid_is_ok = aid_canonize($aid);
530
                        $aid_is_ok = aid_canonize($aid);
530
                        if ($aid_is_ok) $ids[] = new OIDplusAltId('aid', $aid, _L('Application Identifier (ISO/IEC 7816)'), ' ('._L('No PIX allowed').')');
531
                        if ($aid_is_ok) $ids[] = new OIDplusAltId('aid', $aid, _L('Application Identifier (ISO/IEC 7816)'), ' ('._L('No PIX allowed').')');
531
                } else {
532
                } else {
532
                        $oid_parts = explode('.',$this->nodeId(false));
-
 
533
                        if ((count($oid_parts) == 9) && ($oid_parts[0] == '1') && ($oid_parts[1] == '3') && ($oid_parts[2] == '6') && ($oid_parts[3] == '1') && ($oid_parts[4] == '4') && ($oid_parts[5] == '1') && ($oid_parts[6] == '37476') && ($oid_parts[7] == '2')) {
533
                        if ((count($oid_parts) == 9) && ($oid_parts[0] == '1') && ($oid_parts[1] == '3') && ($oid_parts[2] == '6') && ($oid_parts[3] == '1') && ($oid_parts[4] == '4') && ($oid_parts[5] == '1') && ($oid_parts[6] == '37476') && ($oid_parts[7] == '2')) {
534
                                $number = str_pad($oid_parts[8],4,'0',STR_PAD_LEFT);
534
                                $number = str_pad($oid_parts[8],4,'0',STR_PAD_LEFT);
535
                                $aid = 'D276000186B2'.$number;
535
                                $aid = 'D276000186B2'.$number;
536
                                $aid_is_ok = aid_canonize($aid);
536
                                $aid_is_ok = aid_canonize($aid);
537
                                if ($aid_is_ok) $ids[] = new OIDplusAltId('aid', $aid, _L('Application Identifier (ISO/IEC 7816)'), ' ('._L('Optional PIX allowed').')');
537
                                if ($aid_is_ok) $ids[] = new OIDplusAltId('aid', $aid, _L('Application Identifier (ISO/IEC 7816)'), ' ('._L('Optional PIX allowed').')');
538
                        }
538
                        }
539
                }
539
                }
540
 
540
 
-
 
541
                // (VTS B2 00 05) OIDplus System AID / Information Object AID
-
 
542
                if ((count($oid_parts) == 10) && ($oid_parts[0] == '1') && ($oid_parts[1] == '3') && ($oid_parts[2] == '6') && ($oid_parts[3] == '1') && ($oid_parts[4] == '4') && ($oid_parts[5] == '1') && ($oid_parts[6] == '37476') && ($oid_parts[7] == '30') && ($oid_parts[8] == '9')) {
-
 
543
                        $sid = $oid_parts[9];
-
 
544
                        $sid_hex = strtoupper(str_pad(dechex((int)$sid),8,'0',STR_PAD_LEFT));
-
 
545
                        $aid = 'D276000186B20005'.$sid_hex;
-
 
546
                        $aid_is_ok = aid_canonize($aid);
-
 
547
                        if ($aid_is_ok) $ids[] = new OIDplusAltId('aid', $aid, _L('OIDplus System Application Identifier (ISO/IEC 7816)'), ' ('._L('No PIX allowed').')');
-
 
548
                }
-
 
549
                else if ((count($oid_parts) == 11) && ($oid_parts[0] == '1') && ($oid_parts[1] == '3') && ($oid_parts[2] == '6') && ($oid_parts[3] == '1') && ($oid_parts[4] == '4') && ($oid_parts[5] == '1') && ($oid_parts[6] == '37476') && ($oid_parts[7] == '30') && ($oid_parts[8] == '9')) {
-
 
550
                        $sid = $oid_parts[9];
-
 
551
                        $obj = $oid_parts[10];
-
 
552
                        $sid_hex = strtoupper(str_pad(dechex((int)$sid),8,'0',STR_PAD_LEFT));
-
 
553
                        $obj_hex = strtoupper(str_pad(dechex((int)$obj),8,'0',STR_PAD_LEFT));
-
 
554
                        $aid = 'D276000186B20005'.$sid_hex.$obj_hex;
-
 
555
                        $aid_is_ok = aid_canonize($aid);
-
 
556
                        if ($aid_is_ok) $ids[] = new OIDplusAltId('aid', $aid, _L('OIDplus Information Object Application Identifier (ISO/IEC 7816)'), ' ('._L('No PIX allowed').')');
-
 
557
                }
-
 
558
 
541
                // (VTS F0) IANA PEN to AID Mapping (PIX allowed)
559
                // (VTS F0) IANA PEN to AID Mapping (PIX allowed)
542
                $oid_parts = explode('.',$this->nodeId(false));
-
 
543
                if ((count($oid_parts) == 7) && ($oid_parts[0] == '1') && ($oid_parts[1] == '3') && ($oid_parts[2] == '6') && ($oid_parts[3] == '1') && ($oid_parts[4] == '4') && ($oid_parts[5] == '1')) {
560
                if ((count($oid_parts) == 7) && ($oid_parts[0] == '1') && ($oid_parts[1] == '3') && ($oid_parts[2] == '6') && ($oid_parts[3] == '1') && ($oid_parts[4] == '4') && ($oid_parts[5] == '1')) {
544
                        $pen = $oid_parts[6];
561
                        $pen = $oid_parts[6];
545
                        $aid = 'D276000186F0'.$pen;
562
                        $aid = 'D276000186F0'.$pen;
546
                        if (strlen($aid)%2 == 1) $aid .= 'F';
563
                        if (strlen($aid)%2 == 1) $aid .= 'F';
547
                        $aid_is_ok = aid_canonize($aid);
564
                        $aid_is_ok = aid_canonize($aid);
548
                        if ($aid_is_ok) $ids[] = new OIDplusAltId('aid', $aid, _L('Application Identifier (ISO/IEC 7816)'), ' ('._L('Optional PIX allowed, with "FF" prefix').')');
565
                        if ($aid_is_ok) $ids[] = new OIDplusAltId('aid', $aid, _L('Application Identifier (ISO/IEC 7816)'), ' ('._L('Optional PIX allowed, with "FF" prefix').')');
549
                        $ids[] = new OIDplusAltId('iana-pen', $pen, _L('IANA Private Enterprise Number (PEN)'));
566
                        $ids[] = new OIDplusAltId('iana-pen', $pen, _L('IANA Private Enterprise Number (PEN)'));
550
                }
567
                }
551
 
568
 
552
                // (VTS F1) FreeOID to AID Mapping (PIX allowed)
569
                // (VTS F1) FreeOID to AID Mapping (PIX allowed)
553
                $oid_parts = explode('.',$this->nodeId(false));
-
 
554
                if ((count($oid_parts) == 9) && ($oid_parts[0] == '1') && ($oid_parts[1] == '3') && ($oid_parts[2] == '6') && ($oid_parts[3] == '1') && ($oid_parts[4] == '4') && ($oid_parts[5] == '1') && ($oid_parts[6] == '37476') && ($oid_parts[7] == '9000')) {
570
                if ((count($oid_parts) == 9) && ($oid_parts[0] == '1') && ($oid_parts[1] == '3') && ($oid_parts[2] == '6') && ($oid_parts[3] == '1') && ($oid_parts[4] == '4') && ($oid_parts[5] == '1') && ($oid_parts[6] == '37476') && ($oid_parts[7] == '9000')) {
555
                        $number = $oid_parts[8];
571
                        $number = $oid_parts[8];
556
                        $aid = 'D276000186F1'.$number;
572
                        $aid = 'D276000186F1'.$number;
557
                        if (strlen($aid)%2 == 1) $aid .= 'F';
573
                        if (strlen($aid)%2 == 1) $aid .= 'F';
558
                        $aid_is_ok = aid_canonize($aid);
574
                        $aid_is_ok = aid_canonize($aid);
Line 564... Line 580...
564
                        $test_der = \OidDerConverter::hexarrayToStr(\OidDerConverter::oidToDER($this->nodeId(false)));
580
                        $test_der = \OidDerConverter::hexarrayToStr(\OidDerConverter::oidToDER($this->nodeId(false)));
565
                } catch (\Exception $e) {
581
                } catch (\Exception $e) {
566
                        $test_der = '00'; // error, should not happen
582
                        $test_der = '00'; // error, should not happen
567
                }
583
                }
568
                if (substr($test_der,0,3) == '06 ') { // 06 = ASN.1 type of Absolute ID
584
                if (substr($test_der,0,3) == '06 ') { // 06 = ASN.1 type of Absolute ID
569
                        $oid_parts = explode('.',$this->nodeId(false));
-
 
570
                        if (($oid_parts[0] == '2') && ($oid_parts[1] == '999')) {
585
                        if (($oid_parts[0] == '2') && ($oid_parts[1] == '999')) {
571
                                // Note that "ViaThinkSoft E0" AID are not unique!
586
                                // Note that "ViaThinkSoft E0" AID are not unique!
572
                                // OIDplus will use the relative DER of the 2.999.xx OID as PIX
587
                                // OIDplus will use the relative DER of the 2.999.xx OID as PIX
573
                                $aid_candidate = 'D2 76 00 01 86 E0 ' . substr($test_der, strlen('06 xx 88 37 ')); // Remove ASN.1 06=Type, xx=Length and the 2.999 arcs "88 37"
588
                                $aid_candidate = 'D2 76 00 01 86 E0 ' . substr($test_der, strlen('06 xx 88 37 ')); // Remove ASN.1 06=Type, xx=Length and the 2.999 arcs "88 37"
574
                                $aid_is_ok = aid_canonize($aid_candidate);
589
                                $aid_is_ok = aid_canonize($aid_candidate);