Subversion Repositories oidinfo_api

Rev

Rev 8 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 daniel-mar 1
<?php
2
 
8 daniel-mar 3
/*
4
 * OID-Info.com API for PHP
5
 * Copyright 2019 Daniel Marschall, ViaThinkSoft
6
 * Version 2019-11-01
7
 *
8
 * Licensed under the Apache License, Version 2.0 (the "License");
9
 * you may not use this file except in compliance with the License.
10
 * You may obtain a copy of the License at
11
 *
12
 *     http://www.apache.org/licenses/LICENSE-2.0
13
 *
14
 * Unless required by applicable law or agreed to in writing, software
15
 * distributed under the License is distributed on an "AS IS" BASIS,
16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
 * See the License for the specific language governing permissions and
18
 * limitations under the License.
19
 */
20
 
2 daniel-mar 21
require_once __DIR__ . '/oidinfo_api.inc.phps';
22
 
23
$oa = new OIDInfoAPI();
24
 
25
$oa->loadIllegalityRuleFile('oid_illegality_rules');
26
 
27
assert($oa->illegalOID('1.3.6.1.2.1.9999') === true);
28
assert($oa->illegalOID('1.3.6.1.2.1.9999.123') === true);
29
assert($oa->illegalOID('2.999') === false);
30
assert($oa->illegalOID('3') === true);
31
assert($oa->illegalOID('1') === false);
32
assert($oa->illegalOID('1.0.16') === true);
33
assert($oa->illegalOID('1.2.6.0') === true); // 1.2.6 is illegal -> 1.2.6.0 too
8 daniel-mar 34
assert($oa->illegalOID('2.25.340282366920938463463374607431768211455') === false);
35
assert($oa->illegalOID('2.25.340282366920938463463374607431768211456') === true);
2 daniel-mar 36
 
27 daniel-mar 37
assert($oa->strictCheckSyntax('0') === true);
38
assert($oa->strictCheckSyntax('1') === true);
39
assert($oa->strictCheckSyntax('(requesting)') === false);