Subversion Repositories oidplus

Rev

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

Rev 1333 Rev 1336
Line 110... Line 110...
110
                'adminPages',
110
                'adminPages',
111
                'objectTypes',
111
                'objectTypes',
112
                'captcha'
112
                'captcha'
113
        );
113
        );
114
 
114
 
115
        const UUID_NAMEBASED_NS_Base64PubKey = 'fd16965c-8bab-11ed-8744-3c4a92df8582';
115
        //const UUID_NAMEBASED_NS_Base64PubKey = 'fd16965c-8bab-11ed-8744-3c4a92df8582';
116
 
116
 
117
        /**
117
        /**
118
         * Private constructor (Singleton)
118
         * Private constructor (Singleton)
119
         */
119
         */
120
        private function __construct() {
120
        private function __construct() {
Line 842... Line 842...
842
                                $coll = [];
842
                                $coll = [];
843
                                for ($i = 1; $i <= 185; $i++) {
843
                                for ($i = 1; $i <= 185; $i++) {
844
                                        $block4 = dechex(hexdec(substr(sha1('1.3.6.1.4.1.37476.2.5.2.4.8.'.$i), -4)) & 0x3FFF | 0x8000);
844
                                        $block4 = dechex(hexdec(substr(sha1('1.3.6.1.4.1.37476.2.5.2.4.8.'.$i), -4)) & 0x3FFF | 0x8000);
845
                                        $coll[] = $block4;
845
                                        $coll[] = $block4;
846
                                }
846
                                }
-
 
847
                                $coll[] = dechex(0x8000); // System UUID
847
                                $block4 = dechex(hexdec(substr(sha1($plugin->getManifest()->getOid()), -4)) & 0x3FFF | 0x8000);
848
                                $block4 = dechex(hexdec(substr(sha1($plugin->getManifest()->getOid()), -4)) & 0x3FFF | 0x8000);
848
                                if (in_array($block4, $coll)) {
849
                                if (in_array($block4, $coll)) {
849
                                        throw new OIDplusException(_L("A third-party vendor object type plugin with OID %1 has a hash-conflict with a ViaThinkSoft plugin. Please recommend to the developer to pick a different OID for their plugin. More information here: %2",$plugin->getManifest()->getOid(),'https://github.com/danielmarschall/oidplus/blob/master/doc/oidplus_custom_guid.md'));
850
                                        throw new OIDplusException(_L("A third-party vendor object type plugin with OID %1 has a hash-conflict with a ViaThinkSoft plugin. Please recommend to the developer to pick a different OID for their plugin. More information here: %2",$plugin->getManifest()->getOid(),'https://github.com/danielmarschall/oidplus/blob/master/doc/oidplus_custom_guid.md'));
850
                                }
851
                                }
851
                        }
852
                        }
Line 1648... Line 1649...
1648
        /**
1649
        /**
1649
         * @param string $pubKey
1650
         * @param string $pubKey
1650
         * @return false|string
1651
         * @return false|string
1651
         */
1652
         */
1652
        private static function getSystemGuidFromPubKey(string $pubKey) {
1653
        private static function getSystemGuidFromPubKey(string $pubKey) {
-
 
1654
                /*
1653
                $rawData = self::pubKeyToRaw($pubKey);
1655
                $rawData = self::pubKeyToRaw($pubKey);
1654
                if ($rawData === false) return false;
1656
                if ($rawData === false) return false;
1655
                $normalizedBase64 = base64_encode($rawData);
1657
                $normalizedBase64 = base64_encode($rawData);
1656
                return gen_uuid_sha1_namebased(self::UUID_NAMEBASED_NS_Base64PubKey, $normalizedBase64);
1658
                return gen_uuid_sha1_namebased(self::UUID_NAMEBASED_NS_Base64PubKey, $normalizedBase64);
-
 
1659
                */
-
 
1660
 
-
 
1661
                // https://github.com/danielmarschall/oidplus/blob/master/doc/oidplus_custom_guid.md
-
 
1662
                $sysid = OIDplus::getSystemId(false);
-
 
1663
                $sysid_int = $sysid ? $sysid : 0;
-
 
1664
                return gen_uuid_v8(
-
 
1665
                        dechex($sysid_int),
-
 
1666
                        dechex(0), // Creation time of the system unknown
-
 
1667
                        dechex(0), // Reserved
-
 
1668
                        dechex(0), // 0=System, otherwise Object Namespace
-
 
1669
                        sha1('') // Objectname, empty string for system UUID
-
 
1670
                );
1657
        }
1671
        }
1658
 
1672
 
1659
        private static $system_id_cache = null;
1673
        private static $system_id_cache = null;
1660
 
1674
 
1661
        /**
1675
        /**