Rev 2 | Rev 5 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2 | Rev 4 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | <?php |
1 | <?php |
2 | 2 | ||
3 | /* |
3 | /* |
4 | * OidDerConverter.class.php, Version 1.1; Based on version 1.11 of oid.c |
4 | * OidDerConverter.class.php, Version 1.1; Based on version 1.11 of oid.c |
5 | * Copyright 2014-2015 Daniel Marschall, ViaThinkSoft |
5 | * Copyright 2014-2022 Daniel Marschall, ViaThinkSoft |
6 | * |
6 | * |
7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
8 | * you may not use this file except in compliance with the License. |
8 | * you may not use this file except in compliance with the License. |
9 | * You may obtain a copy of the License at |
9 | * You may obtain a copy of the License at |
10 | * |
10 | * |
Line 29... | Line 29... | ||
29 | * @return array(0x12, 0x23) |
29 | * @return array(0x12, 0x23) |
30 | */ |
30 | */ |
31 | // Doesn't need to be public, but it is a nice handy function, especially in the testcases |
31 | // Doesn't need to be public, but it is a nice handy function, especially in the testcases |
32 | public static function hexStrToArray($str) { |
32 | public static function hexStrToArray($str) { |
33 | $out = array(); |
33 | $out = array(); |
34 | - | ||
35 | $str = str_replace('\x', ' ', $str); |
34 | $str = str_replace('\x', '', $str); |
36 | $str = trim($str); |
35 | $str = trim($str); |
37 | $ary = explode(' ', $str); |
36 | $str = str_replace(' ', '', $str); |
38 | - | ||
- | 37 | $ary = str_split($str, 2); |
|
39 | foreach ($ary as &$a) { |
38 | foreach ($ary as &$a) { |
40 | $out[] = hexdec($a); |
39 | $a = hexdec($a); |
41 | } |
40 | } |
42 | - | ||
43 | return $out; |
41 | return $ary; |
44 | } |
42 | } |
45 | 43 | ||
46 | /** |
44 | /** |
47 | * @return Outputs .<oid> for an absolute OID and <oid> for a relative OID. |
45 | * @return Outputs .<oid> for an absolute OID and <oid> for a relative OID. |
48 | */ |
46 | */ |