1 | <?php |
||
20 | class Asn1 |
||
21 | { |
||
22 | /** |
||
23 | * Get CNPJ owner number from digital certificate |
||
24 | * (more specifically, from public key) |
||
25 | * @param string $publickeyUnformated |
||
26 | * @return string CNPJ |
||
27 | */ |
||
28 | 18 | public static function getCNPJ($publickeyUnformated) |
|
34 | |||
35 | /** |
||
36 | * CPF |
||
37 | * OID = 2.16.76.1.3.1 e |
||
38 | * conteúdo = nas primeiras 8 (oito) posições, |
||
39 | * a data de nascimento do titular, |
||
40 | * no formato ddmmaaaa; |
||
41 | * nas 11 (onze) posições subseqüentes, |
||
42 | * o Cadastro de Pessoa Física (CPF) do titular; |
||
43 | * nas 11 (onze) posições subseqüentes, |
||
44 | * o número de inscrição do titular no PIS/PASEP; |
||
45 | * nas 11 (onze) posições subseqüentes, |
||
46 | * o número do Registro Geral - RG do titular; |
||
47 | * nas 6 (seis) posições subseqüentes, |
||
48 | * as siglas do órgão expedidor do RG |
||
49 | * e respectiva UF. |
||
50 | */ |
||
51 | /** |
||
52 | * Get CPF owner number from digital certificate |
||
53 | * (more specifically, from public key) |
||
54 | * @param string $publickeyUnformated |
||
55 | * @return string CPF |
||
56 | */ |
||
57 | public static function getCPF($publickeyUnformated) |
||
63 | |||
64 | /** |
||
65 | * Recovers information regarding the OID contained in the certificate |
||
66 | * method assumes that the OID is embedded within a structure of |
||
67 | * type "sequence", as the first element of the structure |
||
68 | * @param string $publickeyUnformated |
||
69 | * @param string $oidNumber OID formated number |
||
70 | * @return string |
||
71 | */ |
||
72 | 18 | public static function getOIDdata($oidNumber, $publickeyUnformated) |
|
119 | |||
120 | /** |
||
121 | * Get length of data field of a sequency from certifcate |
||
122 | * @param string $data |
||
123 | * @return integer |
||
124 | */ |
||
125 | 15 | protected static function getLength($data) |
|
139 | |||
140 | /** |
||
141 | * Convert number OID in ASC Hex representation includes |
||
142 | * in DER format certificate |
||
143 | * @param string $oid OID formated number |
||
144 | * @return string hexadecimal representation |
||
145 | */ |
||
146 | 18 | protected static function oidHexMarker($oid) |
|
168 | |||
169 | /** |
||
170 | * Converts to Base128 |
||
171 | * @param array $abIn |
||
172 | * @param integer $qIn |
||
173 | * @param boolean $flag |
||
174 | * @return array |
||
175 | */ |
||
176 | 18 | protected static function xBase128($abIn, $qIn, $flag) |
|
190 | } |
||
191 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.