source: trunk/seguranca/classes/funcoes_auxiliares.php @ 1035

Revision 1035, 70.0 KB checked in by rafaelraymundo, 15 years ago (diff)

Ticket #558 - Adicionada funcionalidade de assinatura e criptografia de e-mails.

Line 
1<?php
2//  Conjunto de funcoes de apoio as Classes de tratamento do certificado digital.
3       
4                function pega_path($chaves,$linha)
5                {
6                        if(!is_array($chaves) || !$linha)
7                                {
8                                        return false;
9                                }
10                        $ret = false;
11                        foreach($chaves as $chave)
12                                {
13                                        if(substr($linha,0,strlen($chave)) == $chave)
14                                                {
15                                                        $c = '';
16                                                        if(strpos($linha,'\'') > 0)
17                                                                {
18                                                                        $c = "'";
19                                                                }
20                                                        if(strpos($linha,'"') > 0)
21                                                                {
22                                                                        $c = '"';
23                                                                }
24                                                        if(!$c)
25                                                                {
26                                                                        break;
27                                                                }
28                                                        $data = explode($c,$linha);
29                                                        $ret = $data[1];
30                                                        break;
31                                                }
32                                }
33                        return $ret;
34                }
35       
36        function ler_certificados_CAS($path)
37                {
38                        // Ler o arquivo contendo certificados das Cas.
39                        // Retorna array com os certificados formato PEM ...
40                        $retorno = array();             
41                        if(file_exists($path))
42                                {
43                                        $dados_do_arquivo = file_get_contents($path);
44                                        $inicio = '-----BEGIN CERTIFICATE-----';
45                                        $fim = '-----END CERTIFICATE-----';
46                                        $aux1 = explode($inicio,$dados_do_arquivo);
47                                        foreach($aux1 as $aux2)
48                                                {
49                                                        if($aux2)
50                                                                {
51                                                                        $aux3 = explode($fim,$aux2);
52                                                                        $retorno[] =$inicio . $aux3[0] . $fim;
53                                                                }
54                                                }
55                                }
56                        return $retorno;
57                }
58       
59        function gera_xml_com_dados_do_certificado($dados)
60                {
61                        // Recebe array com dados de um certificado e gera o xml com estes dados.
62                        // As chaves formam os tags e os dados  o conteudo do tag ....
63                        $aux_xml = "<certificado>";
64                        if(is_array($dados))
65                                {
66                                        foreach($dados as $K => $valor)
67                                                {
68                                                        if(!is_array($valor))
69                                                                {
70                                                                        $aux_xml .= '  <' . $K . '>'.$valor.'</' . $K . '>';
71                                                                }
72                                                        else
73                                                                {
74                                                                        $aux_xml .= '  <' . $K . '>';
75                                                                        foreach($valor as $KX => $valorx)
76                                                                                {
77                                                                                        if(is_int($KX))  $KX = 'D' . $KX;
78                                                                                        $aux_xml .= '  <' . $KX . '>'.$valorx.'</' . $KX . '>';
79                                                                                }
80                                                                        $aux_xml .= '  </' . $K . '>';
81                                                                }
82                                                }
83                                }
84                        $aux_xml .= "</certificado>";
85                        return  $aux_xml;
86                }
87               
88               
89        function data_hora ($valor)
90        {
91                $year  = substr($valor, 0, 2);
92                $month = substr($valor, 2, 2);
93                $day   = substr($valor, 4, 2);
94                $hour  = substr($valor, 6, 2);
95                $min   = substr($valor, 8, 2);
96                $sec   = substr($valor, 10, 2);
97                return gmdate('YmdHis',gmmktime($hour, $min, $sec, $month, $day, $year));
98        }
99
100
101        function gera_nome_arquivo_temporario($tab_arqs)
102        {
103                //include('Verifica_Certificado_conf.php');
104                if(!is_dir($GLOBALS['dirtemp']))
105                {
106                        #Se nao existe uma area de trabalho aborta a funcao..
107                        return false;
108                }
109                $lista = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
110                $N = $lista[rand(0,count($lista)-1)].date('U').$lista[rand(0,count($lista)-1)].RAND(12345,9999999999).$lista[rand(0,count($lista)-1)].$lista[rand(0,count($lista)-1)].RAND(12345,9999999999).'.tmp';
111                $aux = $GLOBALS['dirtemp'].'/'.$N;;
112                array_push($tab_arqs ,$aux);
113                return  $aux;           
114        }
115
116
117        function grava_arquivo($arquivo,$dados)
118        {
119                $ret = file_put_contents($arquivo,$dados);
120                if(!$ret)
121                {
122                        return false;
123                }
124                else
125                        return $ret;
126        }
127       
128       
129        function deleta_arquivos_temporarios($tab_arqs)
130        {
131                foreach($tab_arqs as $arquivo )
132                        {
133                                if(file_exists($arquivo))
134                                        {
135                                                unlink($arquivo);
136                                        }
137                        }       
138        }
139
140
141        function verificaopenssl()
142        {
143                if(extension_loaded('openssl'))
144                {
145                        return true;
146                }
147                else
148                        return false;
149        }
150
151
152        function print_hex($value)
153        {
154                $tab_val = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
155                for($A=0;$A<strlen($value);$A++)
156                        {
157                                $aux_parte_numerica =ord(substr($value,$A,1)) % 16;
158                                $aux_parte_zona = (ord(substr($value,$A,1)) - $aux_parte_numerica) / 16;
159                                $parte_numerica = $tab_val[$aux_parte_numerica];
160                                $parte_zona = $tab_val[$aux_parte_zona];
161                                $hex .=  $parte_zona.$parte_numerica;
162                        }
163                        return $hex;
164        }
165
166
167        function get_length($len,$bytes,$data)
168        {
169                $len = ord($data[1]);
170                $bytes = 0;
171                # Testa se tamanho menor/igual a 127 bytes..
172                # Neste caso $len  ja he o tamanho do conteudo
173                if ($len & 0x80)
174                        {
175                                # Testa se tamanho indefinido (nao deve ocorrer em uma codificação DER.
176                                if($len == chr(0x80))
177                                        {
178                                                # Tamanho indefinido, limitado por 0x0000h
179                                                $len = strpos($data,chr(0x00).chr(0x00));
180                                                $bytes = 0;
181                                        }
182                                else                                   
183                                        {
184                                                # he tamanho definido. diz quantos bytes formam o tamanho....
185                                                $bytes = $len & 0x0f;
186                                                $len = 0;
187                                                for ($i = 0; $i < $bytes; $i++)
188                                                        {
189                                                                $len = ($len << 8) | ord($data[$i + 2]);
190                                                        }
191                                        }
192                        }
193        }
194       
195        function xBase128($ab,$q,$flag )
196        {
197                $abc = $ab;
198                if( $q > 127 )
199                        {
200                                $abc = xBase128($abc, floor($q / 128), 0 );
201                        }
202                $q = $q % 128;
203                if( $flag)
204                        {
205                                $abc[] = $q;
206                        }
207                else
208                        {
209                                $abc[] = 0x80 | $q;
210                        }
211                return $abc;
212        }
213
214
215
216        function OIDtoHex($oid)
217        {
218                $abBinary = array();
219                $partes = explode('.',$oid);
220                $n = 0;
221                $b = 0;
222                for($n = 0; $n < count($partes); $n++)
223                {
224                        if($n==0)
225                                {
226                                        $b = 40 * $partes[$n];
227                                }
228                        elseif($n==1)
229                                {
230                                        $b +=  $partes[$n];
231                                        $abBinary[] = $b;
232                                }
233                        else
234                                {
235                                        $abBinary = xBase128($abBinary, $partes[$n], 1 );
236                                }
237                }
238                $value =chr(0x06) . chr(count($abBinary));
239                foreach($abBinary as $item)
240                {
241                        $value .= chr($item);
242                }
243                return $value;
244        }
245       
246       
247       
248        function Crl_parseASN($data,$context_especific = false)
249        { 
250        // Tabela de OIDs .
251                $_oids = array(
252                        '2.5.4.3' => 'CN',
253                        '2.5.4.4' => 'Surname',
254                        '2.5.4.6' => 'C',
255                        '2.5.4.7' => 'Cidade',
256                        '2.5.4.8' => 'Estatdo',
257                        '2.5.4.9' => 'StreetAddress',
258                        '2.5.4.10' => 'O',
259                        '2.5.4.11' => 'OU',
260                        '2.5.4.12' => 'Title',
261                        '2.5.4.20' => 'TelephoneNumber',
262                        '2.5.4.42' => 'GivenName',
263                        '2.5.29.14' => 'id-ce-subjectKeyIdentifier',
264                        '2.5.29.15' => 'id-ce-keyUsage',
265                        '2.5.29.17' => 'id-ce-subjectAltName',
266                        '2.5.29.19' => 'id-ce-basicConstraints',
267                        '2.5.29.20' => 'id-ce-cRLNumber',
268                        '2.5.29.31' => 'id-ce-CRLDistributionPoints',
269                        '2.5.29.32' => 'id-ce-certificatePolicies',
270                        '2.5.29.35' => 'id-ce-authorityKeyIdentifier',
271                        '2.5.29.37' => 'id-ce-extKeyUsage',
272                        '1.2.840.113549.1.9.1' => 'Email',
273                        '1.2.840.113549.1.1.1' => 'RSAEncryption',
274                        '1.2.840.113549.1.1.2' => 'md2WithRSAEncryption',
275                        '1.2.840.113549.1.1.4' => 'md5withRSAEncryption',
276                        '1.2.840.113549.1.1.5' => 'SHA-1WithRSAEncryption',
277                        '1.2.840.10040.4.3' => 'id-dsa-with-sha-1',
278                        '1.3.6.1.5.5.7.3.2' => 'id_kp_clientAuth',
279                        '1.3.6.1.5.5.7.3.4' => 'id_kp_securityemail',   
280                        '1.3.6.1.5.5.7.2.1' => 'id_certificatePolicies',
281                        '2.16.840.1.113730.1.1' => 'netscape-cert-type',
282                        '2.16.840.1.113730.1.2' => 'netscape-base-url',
283                        '2.16.840.1.113730.1.3' => 'netscape-revocation-url',
284                        '2.16.840.1.113730.1.4' => 'netscape-ca-revocation-url',
285                        '2.16.840.1.113730.1.7' => 'netscape-cert-renewal-url',
286                        '2.16.840.1.113730.1.8' => 'netscape-ca-policy-url',
287                        '2.16.840.1.113730.1.12' => 'netscape-ssl-server-name',
288                        '2.16.840.1.113730.1.13' => 'netscape-comment',
289                        '2.16.76.1.2.1' => 'A1',       
290                        '2.16.76.1.2.3' => 'A3',       
291                        '2.16.76.1.2.1.16' => 'Certification Practice Statement pointer',
292                        '2.16.76.1.3.1' => 'Dados do cert parte 1',
293                        '2.16.76.1.3.5' => 'Dados do cert parte 2',
294                        '2.16.76.1.3.6' => 'Dados do cert parte 3',
295                        '0.9.2342.19200300.100.1.25' => ' domainComponent',
296                        '1.2.36.68980861.1.1.10' => ' Signet pilot',
297                        '1.2.36.68980861.1.1.11' => ' Signet intraNet',
298                        '1.2.36.68980861.1.1.2' => ' Signet personal',
299                        '1.2.36.68980861.1.1.20' => ' Signet securityPolicy',
300                        '1.2.36.68980861.1.1.3' => ' Signet business',
301                        '1.2.36.68980861.1.1.4' => ' Signet legal',
302                        '1.2.36.75878867.1.100.1.1' => ' Certificates Australia policyIdentifier',
303                        '1.2.752.34.1' => ' seis-cp',
304                        '1.2.752.34.1.1' => ' SEIS certificatePolicy-s10',
305                        '1.2.752.34.2' => ' SEIS pe',
306                        '1.2.752.34.3' => ' SEIS at',
307                        '1.2.752.34.3.1' => ' SEIS at-personalIdentifier',
308                        '1.2.840.10040.2.1' => ' holdinstruction-none',
309                        '1.2.840.10040.2.2' => ' holdinstruction-callissuer',
310                        '1.2.840.10040.2.3' => ' holdinstruction-reject',
311                        '1.2.840.10040.4.1' => ' dsa',
312                        '1.2.840.10040.4.3' => ' dsaWithSha1',
313                        '1.2.840.10045.1' => ' fieldType',
314                        '1.2.840.10045.1.1' => ' prime-field',
315                        '1.2.840.10045.1.2' => ' characteristic-two-field',
316                        '1.2.840.10045.1.2.1' => ' ecPublicKey',
317                        '1.2.840.10045.1.2.3' => ' characteristic-two-basis',
318                        '1.2.840.10045.1.2.3.1' => ' onBasis',
319                        '1.2.840.10045.1.2.3.2' => ' tpBasis',
320                        '1.2.840.10045.1.2.3.3' => ' ppBasis',
321                        '1.2.840.10045.2' => ' publicKeyType',
322                        '1.2.840.10045.2.1' => ' ecPublicKey',
323                        '1.2.840.10046.2.1' => ' dhPublicNumber',
324                        '1.2.840.113533.7' => ' nsn',
325                        '1.2.840.113533.7.65' => ' nsn-ce',
326                        '1.2.840.113533.7.65.0' => ' entrustVersInfo',
327                        '1.2.840.113533.7.66' => ' nsn-alg',
328                        '1.2.840.113533.7.66.10' => ' cast5CBC',
329                        '1.2.840.113533.7.66.11' => ' cast5MAC',
330                        '1.2.840.113533.7.66.12' => ' pbeWithMD5AndCAST5-CBC',
331                        '1.2.840.113533.7.66.13' => ' passwordBasedMac',
332                        '1.2.840.113533.7.66.3' => ' cast3CBC',
333                        '1.2.840.113533.7.67' => ' nsn-oc',
334                        '1.2.840.113533.7.67.0' => ' entrustUser',
335                        '1.2.840.113533.7.68' => ' nsn-at',
336                        '1.2.840.113533.7.68.0' => ' entrustCAInfo',
337                        '1.2.840.113533.7.68.10' => ' attributeCertificate',
338                        '1.2.840.113549.1.1' => ' pkcs-1',
339                        '1.2.840.113549.1.1.1' => ' rsaEncryption',
340                        '1.2.840.113549.1.1.2' => ' md2withRSAEncryption',
341                        '1.2.840.113549.1.1.3' => ' md4withRSAEncryption',
342                        '1.2.840.113549.1.1.4' => ' md5withRSAEncryption',
343                        '1.2.840.113549.1.1.5' => ' sha1withRSAEncryption',
344                        '1.2.840.113549.1.1.6' => ' rsaOAEPEncryptionSET',
345                        '1.2.840.113549.1.9.16.2.11' => 'SMIMEEncryptionKeyPreference',
346                        '1.2.840.113549.1.12' => ' pkcs-12',
347                        '1.2.840.113549.1.12.1' => ' pkcs-12-PbeIds',
348                        '1.2.840.113549.1.12.1.1' => ' pbeWithSHAAnd128BitRC4',
349                        '1.2.840.113549.1.12.1.2' => ' pbeWithSHAAnd40BitRC4',
350                        '1.2.840.113549.1.12.1.3' => ' pbeWithSHAAnd3-KeyTripleDES-CBC',
351                        '1.2.840.113549.1.12.1.4' => ' pbeWithSHAAnd2-KeyTripleDES-CBC',
352                        '1.2.840.113549.1.12.1.5' => ' pbeWithSHAAnd128BitRC2-CBC',
353                        '1.2.840.113549.1.12.1.6' => ' pbeWithSHAAnd40BitRC2-CBC',
354                        '1.2.840.113549.1.12.10' => ' pkcs-12Version1',
355                        '1.2.840.113549.1.12.10.1' => ' pkcs-12BadIds',
356                        '1.2.840.113549.1.12.10.1.1' => ' pkcs-12-keyBag',
357                        '1.2.840.113549.1.12.10.1.2' => ' pkcs-12-pkcs-8ShroudedKeyBag',
358                        '1.2.840.113549.1.12.10.1.3' => ' pkcs-12-certBag',
359                        '1.2.840.113549.1.12.10.1.4' => ' pkcs-12-crlBag',
360                        '1.2.840.113549.1.12.10.1.5' => ' pkcs-12-secretBag',
361                        '1.2.840.113549.1.12.10.1.6' => ' pkcs-12-safeContentsBag',
362                        '1.2.840.113549.1.12.2' => ' pkcs-12-ESPVKID',
363                        '1.2.840.113549.1.12.2.1' => ' pkcs-12-PKCS8KeyShrouding',
364                        '1.2.840.113549.1.12.3' => ' pkcs-12-BagIds',
365                        '1.2.840.113549.1.12.3.1' => ' pkcs-12-keyBagId',
366                        '1.2.840.113549.1.12.3.2' => ' pkcs-12-certAndCRLBagId',
367                        '1.2.840.113549.1.12.3.3' => ' pkcs-12-secretBagId',
368                        '1.2.840.113549.1.12.3.4' => ' pkcs-12-safeContentsId',
369                        '1.2.840.113549.1.12.3.5' => ' pkcs-12-pkcs-8ShroudedKeyBagId',
370                        '1.2.840.113549.1.12.4' => ' pkcs-12-CertBagID',
371                        '1.2.840.113549.1.12.4.1' => ' pkcs-12-X509CertCRLBagID',
372                        '1.2.840.113549.1.12.4.2' => ' pkcs-12-SDSICertBagID',
373                        '1.2.840.113549.1.12.5' => ' pkcs-12-OID',
374                        '1.2.840.113549.1.12.5.1' => ' pkcs-12-PBEID',
375                        '1.2.840.113549.1.12.5.1.1' => ' pkcs-12-PBEWithSha1And128BitRC4',
376                        '1.2.840.113549.1.12.5.1.2' => ' pkcs-12-PBEWithSha1And40BitRC4',
377                        '1.2.840.113549.1.12.5.1.3' => ' pkcs-12-PBEWithSha1AndTripleDESCBC',
378                        '1.2.840.113549.1.12.5.1.4' => ' pkcs-12-PBEWithSha1And128BitRC2CBC',
379                        '1.2.840.113549.1.12.5.1.5' => ' pkcs-12-PBEWithSha1And40BitRC2CBC',
380                        '1.2.840.113549.1.12.5.1.6' => ' pkcs-12-PBEWithSha1AndRC4',
381                        '1.2.840.113549.1.12.5.1.7' => ' pkcs-12-PBEWithSha1AndRC2CBC',
382                        '1.2.840.113549.1.12.5.2' => ' pkcs-12-EnvelopingID',
383                        '1.2.840.113549.1.12.5.2.1' => ' pkcs-12-RSAEncryptionWith128BitRC4',
384                        '1.2.840.113549.1.12.5.2.2' => ' pkcs-12-RSAEncryptionWith40BitRC4',
385                        '1.2.840.113549.1.12.5.2.3' => ' pkcs-12-RSAEncryptionWithTripleDES',
386                        '1.2.840.113549.1.12.5.3' => ' pkcs-12-SignatureID',
387                        '1.2.840.113549.1.12.5.3.1' => ' pkcs-12-RSASignatureWithSHA1Digest',
388                        '1.2.840.113549.1.3' => ' pkcs-3',
389                        '1.2.840.113549.1.3.1' => ' dhKeyAgreement',
390                        '1.2.840.113549.1.5' => ' pkcs-5',
391                        '1.2.840.113549.1.5.1' => ' pbeWithMD2AndDES-CBC',
392                        '1.2.840.113549.1.5.10' => ' pbeWithSHAAndDES-CBC',
393                        '1.2.840.113549.1.5.3' => ' pbeWithMD5AndDES-CBC',
394                        '1.2.840.113549.1.5.4' => ' pbeWithMD2AndRC2-CBC',
395                        '1.2.840.113549.1.5.6' => ' pbeWithMD5AndRC2-CBC',
396                        '1.2.840.113549.1.5.9' => ' pbeWithMD5AndXOR',
397                        '1.2.840.113549.1.7' => ' pkcs-7',
398                        '1.2.840.113549.1.7.1' => ' data',
399                        '1.2.840.113549.1.7.2' => ' signedData',
400                        '1.2.840.113549.1.7.3' => ' envelopedData',
401                        '1.2.840.113549.1.7.4' => ' signedAndEnvelopedData',
402                        '1.2.840.113549.1.7.5' => ' digestData',
403                        '1.2.840.113549.1.7.6' => ' encryptedData',
404                        '1.2.840.113549.1.7.7' => ' dataWithAttributes',
405                        '1.2.840.113549.1.7.8' => ' encryptedPrivateKeyInfo',
406                        '1.2.840.113549.1.9' => ' pkcs-9',
407                        '1.2.840.113549.1.9.1' => ' emailAddress',
408                        '1.2.840.113549.1.9.10' => ' issuerAndSerialNumber',
409                        '1.2.840.113549.1.9.11' => ' passwordCheck',
410                        '1.2.840.113549.1.9.12' => ' publicKey',
411                        '1.2.840.113549.1.9.13' => ' signingDescription',
412                        '1.2.840.113549.1.9.14' => ' extensionReq',
413                        '1.2.840.113549.1.9.15' => ' sMIMECapabilities',
414                        '1.2.840.113549.1.9.15.1' => ' preferSignedData',
415                        '1.2.840.113549.1.9.15.2' => ' canNotDecryptAny',
416                        '1.2.840.113549.1.9.15.3' => ' receiptRequest',
417                        '1.2.840.113549.1.9.15.4' => ' receipt',
418                        '1.2.840.113549.1.9.15.5' => ' contentHints',
419                        '1.2.840.113549.1.9.15.6' => ' mlExpansionHistory',
420                        '1.2.840.113549.1.9.16' => ' id-sMIME',
421                        '1.2.840.113549.1.9.16.0' => ' id-mod',
422                        '1.2.840.113549.1.9.16.0.1' => ' id-mod-cms',
423                        '1.2.840.113549.1.9.16.0.2' => ' id-mod-ess',
424                        '1.2.840.113549.1.9.16.1' => ' id-ct',
425                        '1.2.840.113549.1.9.16.1.1' => ' id-ct-receipt',
426                        '1.2.840.113549.1.9.16.2' => ' id-aa',
427                        '1.2.840.113549.1.9.16.2.1' => ' id-aa-receiptRequest',
428                        '1.2.840.113549.1.9.16.2.2' => ' id-aa-securityLabel',
429                        '1.2.840.113549.1.9.16.2.3' => ' id-aa-mlExpandHistory',
430                        '1.2.840.113549.1.9.16.2.4' => ' id-aa-contentHint',
431                        '1.2.840.113549.1.9.2' => ' unstructuredName',
432                        '1.2.840.113549.1.9.20' => ' friendlyName',
433                        '1.2.840.113549.1.9.21' => ' localKeyID',
434                        '1.2.840.113549.1.9.22' => ' certTypes',
435                        '1.2.840.113549.1.9.22.1' => ' x509Certificate',
436                        '1.2.840.113549.1.9.22.2' => ' sdsiCertificate',
437                        '1.2.840.113549.1.9.23' => ' crlTypes',
438                        '1.2.840.113549.1.9.23.1' => ' x509Crl',
439                        '1.2.840.113549.1.9.3' => ' contentType',
440                        '1.2.840.113549.1.9.4' => ' messageDigest',
441                        '1.2.840.113549.1.9.5' => ' signingTime',
442                        '1.2.840.113549.1.9.6' => ' countersignature',
443                        '1.2.840.113549.1.9.7' => ' challengePassword',
444                        '1.2.840.113549.1.9.8' => ' unstructuredAddress',
445                        '1.2.840.113549.1.9.9' => ' extendedCertificateAttributes',
446                        '1.2.840.113549.2' => ' digestAlgorithm',
447                        '1.2.840.113549.2.2' => ' md2',
448                        '1.2.840.113549.2.4' => ' md4',
449                        '1.2.840.113549.2.5' => ' md5',
450                        '1.2.840.113549.3' => ' encryptionAlgorithm',
451                        '1.2.840.113549.3.10' => ' desCDMF',
452                        '1.2.840.113549.3.2' => ' rc2CBC',
453                        '1.2.840.113549.3.3' => ' rc2ECB',
454                        '1.2.840.113549.3.4' => ' rc4',
455                        '1.2.840.113549.3.5' => ' rc4WithMAC',
456                        '1.2.840.113549.3.6' => ' DESX-CBC',
457                        '1.2.840.113549.3.7' => ' DES-EDE3-CBC',
458                        '1.2.840.113549.3.8' => ' RC5CBC',
459                        '1.2.840.113549.3.9' => ' RC5-CBCPad',
460                        '1.2.840.113556.4.3' => ' microsoftExcel',
461                        '1.2.840.113556.4.4' => ' titledWithOID',
462                        '1.2.840.113556.4.5' => ' microsoftPowerPoint',
463                        '1.3.133.16.840.9.84' => ' x9-84',
464                        '1.3.133.16.840.9.84.0' => ' x9-84-Module',
465                        '1.3.133.16.840.9.84.0.1' => ' x9-84-Biometrics',
466                        '1.3.133.16.840.9.84.0.2' => ' x9-84-CMS',
467                        '1.3.133.16.840.9.84.0.3' => ' x9-84-Identifiers',
468                        '1.3.133.16.840.9.84.1' => ' biometric',
469                        '1.3.133.16.840.9.84.1.0' => ' id-unknown-Type',
470                        '1.3.133.16.840.9.84.1.1' => ' id-body-Odor',
471                        '1.3.133.16.840.9.84.1.10' => ' id-palm',
472                        '1.3.133.16.840.9.84.1.11' => ' id-retina',
473                        '1.3.133.16.840.9.84.1.12' => ' id-signature',
474                        '1.3.133.16.840.9.84.1.13' => ' id-speech-Pattern',
475                        '1.3.133.16.840.9.84.1.14' => ' id-thermal-Image',
476                        '1.3.133.16.840.9.84.1.15' => ' id-vein-Pattern',
477                        '1.3.133.16.840.9.84.1.16' => ' id-thermal-Face-Image',
478                        '1.3.133.16.840.9.84.1.17' => ' id-thermal-Hand-Image',
479                        '1.3.133.16.840.9.84.1.18' => ' id-lip-Movement',
480                        '1.3.133.16.840.9.84.1.19' => ' id-gait',
481                        '1.3.133.16.840.9.84.1.2' => ' id-dna',
482                        '1.3.133.16.840.9.84.1.3' => ' id-ear-Shape',
483                        '1.3.133.16.840.9.84.1.4' => ' id-facial-Features',
484                        '1.3.133.16.840.9.84.1.5' => ' id-finger-Image',
485                        '1.3.133.16.840.9.84.1.6' => ' id-finger-Geometry',
486                        '1.3.133.16.840.9.84.1.7' => ' id-hand-Geometry',
487                        '1.3.133.16.840.9.84.1.8' => ' id-iris-Features',
488                        '1.3.133.16.840.9.84.1.9' => ' id-keystroke-Dynamics',
489                        '1.3.133.16.840.9.84.2' => ' processing-algorithm',
490                        '1.3.133.16.840.9.84.3' => ' matching-method',
491                        '1.3.133.16.840.9.84.4' => ' format-Owner',
492                        '1.3.133.16.840.9.84.4.0' => ' cbeff-Owner',
493                        '1.3.133.16.840.9.84.4.1' => ' ibia-Owner',
494                        '1.3.133.16.840.9.84.4.1.1' => ' id-ibia-SAFLINK',
495                        '1.3.133.16.840.9.84.4.1.10' => ' id-ibia-SecuGen',
496                        '1.3.133.16.840.9.84.4.1.11' => ' id-ibia-PreciseBiometric',
497                        '1.3.133.16.840.9.84.4.1.12' => ' id-ibia-Identix',
498                        '1.3.133.16.840.9.84.4.1.13' => ' id-ibia-DERMALOG',
499                        '1.3.133.16.840.9.84.4.1.14' => ' id-ibia-LOGICO',
500                        '1.3.133.16.840.9.84.4.1.15' => ' id-ibia-NIST',
501                        '1.3.133.16.840.9.84.4.1.16' => ' id-ibia-A3Vision',
502                        '1.3.133.16.840.9.84.4.1.17' => ' id-ibia-NEC',
503                        '1.3.133.16.840.9.84.4.1.18' => ' id-ibia-STMicroelectronics',
504                        '1.3.133.16.840.9.84.4.1.2' => ' id-ibia-Bioscrypt',
505                        '1.3.133.16.840.9.84.4.1.3' => ' id-ibia-Visionics',
506                        '1.3.133.16.840.9.84.4.1.4' => ' id-ibia-InfineonTechnologiesAG',
507                        '1.3.133.16.840.9.84.4.1.5' => ' id-ibia-IridianTechnologies',
508                        '1.3.133.16.840.9.84.4.1.6' => ' id-ibia-Veridicom',
509                        '1.3.133.16.840.9.84.4.1.7' => ' id-ibia-CyberSIGN',
510                        '1.3.133.16.840.9.84.4.1.8' => ' id-ibia-eCryp.',
511                        '1.3.133.16.840.9.84.4.1.9' => ' id-ibia-FingerprintCardsAB',
512                        '1.3.133.16.840.9.84.4.2' => ' x9-Owner',
513                        '1.3.14.2.26.5' => ' sha',
514                        '1.3.14.3.2.1.1' => ' rsa',
515                        '1.3.14.3.2.10' => ' desMAC',
516                        '1.3.14.3.2.11' => ' rsaSignature',
517                        '1.3.14.3.2.12' => ' dsa',
518                        '1.3.14.3.2.13' => ' dsaWithSHA',
519                        '1.3.14.3.2.14' => ' mdc2WithRSASignature',
520                        '1.3.14.3.2.15' => ' shaWithRSASignature',
521                        '1.3.14.3.2.16' => ' dhWithCommonModulus',
522                        '1.3.14.3.2.17' => ' desEDE',
523                        '1.3.14.3.2.18' => ' sha',
524                        '1.3.14.3.2.19' => ' mdc-2',
525                        '1.3.14.3.2.2' => ' md4WitRSA',
526                        '1.3.14.3.2.2.1' => ' sqmod-N',
527                        '1.3.14.3.2.20' => ' dsaCommon',
528                        '1.3.14.3.2.21' => ' dsaCommonWithSHA',
529                        '1.3.14.3.2.22' => ' rsaKeyTransport',
530                        '1.3.14.3.2.23' => ' keyed-hash-seal',
531                        '1.3.14.3.2.24' => ' md2WithRSASignature',
532                        '1.3.14.3.2.25' => ' md5WithRSASignature',
533                        '1.3.14.3.2.26' => ' sha1',
534                        '1.3.14.3.2.27' => ' dsaWithSHA1',
535                        '1.3.14.3.2.28' => ' dsaWithCommonSHA1',
536                        '1.3.14.3.2.29' => ' sha-1WithRSAEncryption',
537                        '1.3.14.3.2.3' => ' md5WithRSA',
538                        '1.3.14.3.2.3.1' => ' sqmod-NwithRSA',
539                        '1.3.14.3.2.4' => ' md4WithRSAEncryption',
540                        '1.3.14.3.2.6' => ' desECB',
541                        '1.3.14.3.2.7' => ' desCBC',
542                        '1.3.14.3.2.8' => ' desOFB',
543                        '1.3.14.3.2.9' => ' desCFB',
544                        '1.3.14.3.3.1' => ' simple-strong-auth-mechanism',
545                        '1.3.14.7.2.1.1' => ' ElGamal',
546                        '1.3.14.7.2.3.1' => ' md2WithRSA',
547                        '1.3.14.7.2.3.2' => ' md2WithElGamal',
548                        '1.3.36.3' => ' algorithm',
549                        '1.3.36.3.1' => ' encryptionAlgorithm',
550                        '1.3.36.3.1.1' => ' des',
551                        '1.3.36.3.1.1.1.1' => ' desECBPad',
552                        '1.3.36.3.1.1.1.1.1' => ' desECBPadISO',
553                        '1.3.36.3.1.1.2.1' => ' desCBCPad',
554                        '1.3.36.3.1.1.2.1.1' => ' desCBCPadISO',
555                        '1.3.36.3.1.2' => ' idea',
556                        '1.3.36.3.1.2.1' => ' ideaECB',
557                        '1.3.36.3.1.2.1.1' => ' ideaECBPad',
558                        '1.3.36.3.1.2.1.1.1' => ' ideaECBPadISO',
559                        '1.3.36.3.1.2.2' => ' ideaCBC',
560                        '1.3.36.3.1.2.2.1' => ' ideaCBCPad',
561                        '1.3.36.3.1.2.2.1.1' => ' ideaCBCPadISO',
562                        '1.3.36.3.1.2.3' => ' ideaOFB',
563                        '1.3.36.3.1.2.4' => ' ideaCFB',
564                        '1.3.36.3.1.3' => ' des-3',
565                        '1.3.36.3.1.3.1.1' => ' des-3ECBPad',
566                        '1.3.36.3.1.3.1.1.1' => ' des-3ECBPadISO',
567                        '1.3.36.3.1.3.2.1' => ' des-3CBCPad',
568                        '1.3.36.3.1.3.2.1.1' => ' des-3CBCPadISO',
569                        '1.3.36.3.2' => ' hashAlgorithm',
570                        '1.3.36.3.2.1' => ' ripemd160',
571                        '1.3.36.3.2.2' => ' ripemd128',
572                        '1.3.36.3.2.3' => ' ripemd256',
573                        '1.3.36.3.2.4' => ' mdc2singleLength',
574                        '1.3.36.3.2.5' => ' mdc2doubleLength',
575                        '1.3.36.3.3' => ' signatureAlgorithm',
576                        '1.3.36.3.3.1' => ' rsa',
577                        '1.3.36.3.3.1.1' => ' rsaMitSHA-1',
578                        '1.3.36.3.3.1.2' => ' rsaMitRIPEMD160',
579                        '1.3.36.3.3.2' => ' ellipticCurve',
580                        '1.3.36.3.4' => ' signatureScheme',
581                        '1.3.36.3.4.1' => ' iso9796-1',
582                        '1.3.36.3.4.2.1' => ' iso9796-2',
583                        '1.3.36.3.4.2.2' => ' iso9796-2rsa',
584                        '1.3.36.4' => ' attribute',
585                        '1.3.36.5' => ' policy',
586                        '1.3.36.6' => ' api',
587                        '1.3.36.6.1' => ' manufacturerSpecific',
588                        '1.3.36.6.2' => ' functionalitySpecific',
589                        '1.3.36.7' => ' api',
590                        '1.3.36.7.1' => ' keyAgreement',
591                        '1.3.36.7.2' => ' keyTransport',
592                        '1.3.6.1.4.1.2428.10.1.1' => ' UNINETT policyIdentifier',
593                        '1.3.6.1.4.1.2712.10' => ' ICE-TEL policyIdentifier',
594                        '1.3.6.1.4.1.3029.32.1' => ' cryptlibEnvelope',
595                        '1.3.6.1.4.1.3029.32.2' => ' cryptlibPrivateKey',
596                        '1.3.6.1.4.1.311' => ' Microsoft OID',
597                        '1.3.6.1.4.1.311.10' => ' Crypto 2.0',
598                        '1.3.6.1.4.1.311.10.1' => ' certTrustList',
599                        '1.3.6.1.4.1.311.10.1.1' => ' szOID_SORTED_CTL',
600                        '1.3.6.1.4.1.311.10.10' => ' Microsoft CMC OIDs',
601                        '1.3.6.1.4.1.311.10.10.1' => ' szOID_CMC_ADD_ATTRIBUTES',
602                        '1.3.6.1.4.1.311.10.11' => ' Microsoft certificate property OIDs',
603                        '1.3.6.1.4.1.311.10.11.1' => ' szOID_CERT_PROP_ID_PREFIX',
604                        '1.3.6.1.4.1.311.10.12' => ' CryptUI',
605                        '1.3.6.1.4.1.311.10.12.1' => ' szOID_ANY_APPLICATION_POLICY',
606                        '1.3.6.1.4.1.311.10.2' => ' nextUpdateLocation',
607                        '1.3.6.1.4.1.311.10.3.1' => ' certTrustListSigning',
608                        '1.3.6.1.4.1.311.10.3.10' => ' szOID_KP_QUALIFIED_SUBORDINATION',
609                        '1.3.6.1.4.1.311.10.3.11' => ' szOID_KP_KEY_RECOVERY',
610                        '1.3.6.1.4.1.311.10.3.12' => ' szOID_KP_DOCUMENT_SIGNING',
611                        '1.3.6.1.4.1.311.10.3.2' => ' timeStampSigning',
612                        '1.3.6.1.4.1.311.10.3.3' => ' serverGatedCrypto',
613                        '1.3.6.1.4.1.311.10.3.3.1' => ' szOID_SERIALIZED',
614                        '1.3.6.1.4.1.311.10.3.4' => ' encryptedFileSystem',
615                        '1.3.6.1.4.1.311.10.3.4.1' => ' szOID_EFS_RECOVERY',
616                        '1.3.6.1.4.1.311.10.3.5' => ' szOID_WHQL_CRYPTO',
617                        '1.3.6.1.4.1.311.10.3.6' => ' szOID_NT5_CRYPTO',
618                        '1.3.6.1.4.1.311.10.3.7' => ' szOID_OEM_WHQL_CRYPTO',
619                        '1.3.6.1.4.1.311.10.3.8' => ' szOID_EMBEDDED_NT_CRYPTO',
620                        '1.3.6.1.4.1.311.10.3.9' => ' szOID_ROOT_LIST_SIGNER',
621                        '1.3.6.1.4.1.311.10.4.1' => ' yesnoTrustAttr',
622                        '1.3.6.1.4.1.311.10.5.1' => ' szOID_DRM',
623                        '1.3.6.1.4.1.311.10.5.2' => ' szOID_DRM_INDIVIDUALIZATION',
624                        '1.3.6.1.4.1.311.10.6.1' => ' szOID_LICENSES',
625                        '1.3.6.1.4.1.311.10.6.2' => ' szOID_LICENSE_SERVER',
626                        '1.3.6.1.4.1.311.10.7' => ' szOID_MICROSOFT_RDN_PREFIX',
627                        '1.3.6.1.4.1.311.10.7.1' => ' szOID_KEYID_RDN',
628                        '1.3.6.1.4.1.311.10.8.1' => ' szOID_REMOVE_CERTIFICATE',
629                        '1.3.6.1.4.1.311.10.9.1' => ' szOID_CROSS_CERT_DIST_POINTS',
630                        '1.3.6.1.4.1.311.12' => ' Catalog',
631                        '1.3.6.1.4.1.311.12.1.1' => ' szOID_CATALOG_LIST',
632                        '1.3.6.1.4.1.311.12.1.2' => ' szOID_CATALOG_LIST_MEMBER',
633                        '1.3.6.1.4.1.311.12.2.1' => ' CAT_NAMEVALUE_OBJID',
634                        '1.3.6.1.4.1.311.12.2.2' => ' CAT_MEMBERINFO_OBJID',
635                        '1.3.6.1.4.1.311.13' => ' Microsoft PKCS10 OIDs',
636                        '1.3.6.1.4.1.311.13.1' => ' szOID_RENEWAL_CERTIFICATE',
637                        '1.3.6.1.4.1.311.13.2.1' => ' szOID_ENROLLMENT_NAME_VALUE_PAIR',
638                        '1.3.6.1.4.1.311.13.2.2' => ' szOID_ENROLLMENT_CSP_PROVIDER',
639                        '1.3.6.1.4.1.311.13.2.3' => ' OS Version',
640                        '1.3.6.1.4.1.311.15' => ' Microsoft Java',
641                        '1.3.6.1.4.1.311.16' => ' Microsoft Outlook/Exchange',
642                        '1.3.6.1.4.1.311.16.4' => ' Outlook Express',
643                        '1.3.6.1.4.1.311.17' => ' Microsoft PKCS12 attributes',
644                        '1.3.6.1.4.1.311.17.1' => ' szOID_LOCAL_MACHINE_KEYSET',
645                        '1.3.6.1.4.1.311.18' => ' Microsoft Hydra',
646                        '1.3.6.1.4.1.311.19' => ' Microsoft ISPU Test',
647                        '1.3.6.1.4.1.311.2' => ' Authenticode',
648                        '1.3.6.1.4.1.311.2.1.10' => ' spcAgencyInfo',
649                        '1.3.6.1.4.1.311.2.1.11' => ' spcStatementType',
650                        '1.3.6.1.4.1.311.2.1.12' => ' spcSpOpusInfo',
651                        '1.3.6.1.4.1.311.2.1.14' => ' certExtensions',
652                        '1.3.6.1.4.1.311.2.1.15' => ' spcPelmageData',
653                        '1.3.6.1.4.1.311.2.1.18' => ' SPC_RAW_FILE_DATA_OBJID',
654                        '1.3.6.1.4.1.311.2.1.19' => ' SPC_STRUCTURED_STORAGE_DATA_OBJID',
655                        '1.3.6.1.4.1.311.2.1.20' => ' spcLink',
656                        '1.3.6.1.4.1.311.2.1.21' => ' individualCodeSigning',
657                        '1.3.6.1.4.1.311.2.1.22' => ' commercialCodeSigning',
658                        '1.3.6.1.4.1.311.2.1.25' => ' spcLink',
659                        '1.3.6.1.4.1.311.2.1.26' => ' spcMinimalCriteriaInfo',
660                        '1.3.6.1.4.1.311.2.1.27' => ' spcFinancialCriteriaInfo',
661                        '1.3.6.1.4.1.311.2.1.28' => ' spcLink',
662                        '1.3.6.1.4.1.311.2.1.29' => ' SPC_HASH_INFO_OBJID',
663                        '1.3.6.1.4.1.311.2.1.30' => ' SPC_SIPINFO_OBJID',
664                        '1.3.6.1.4.1.311.2.1.4' => ' spcIndirectDataContext',
665                        '1.3.6.1.4.1.311.2.2' => ' CTL for Software Publishers Trusted CAs',
666                        '1.3.6.1.4.1.311.2.2.1' => ' szOID_TRUSTED_CODESIGNING_CA_LIST',
667                        '1.3.6.1.4.1.311.2.2.2' => ' szOID_TRUSTED_CLIENT_AUTH_CA_LIST',
668                        '1.3.6.1.4.1.311.2.2.3' => ' szOID_TRUSTED_SERVER_AUTH_CA_LIST',
669                        '1.3.6.1.4.1.311.20' => ' Microsoft Enrollment Infrastructure',
670                        '1.3.6.1.4.1.311.20.1' => ' szOID_AUTO_ENROLL_CTL_USAGE',
671                        '1.3.6.1.4.1.311.20.2' => ' szOID_ENROLL_CERTTYPE_EXTENSION',
672                        '1.3.6.1.4.1.311.20.2.1' => ' szOID_ENROLLMENT_AGENT',
673                        '1.3.6.1.4.1.311.20.2.2' => ' szOID_KP_SMARTCARD_LOGON',
674                        '1.3.6.1.4.1.311.20.2.3' => ' szOID_NT_PRINCIPAL_NAME',
675                        '1.3.6.1.4.1.311.20.3' => ' szOID_CERT_MANIFOLD',
676                        '1.3.6.1.4.1.311.21' => ' Microsoft CertSrv Infrastructure',
677                        '1.3.6.1.4.1.311.21.1' => ' szOID_CERTSRV_CA_VERSION',
678                        '1.3.6.1.4.1.311.21.20' => ' Client Information',
679                        '1.3.6.1.4.1.311.25' => ' Microsoft Directory Service',
680                        '1.3.6.1.4.1.311.25.1' => ' szOID_NTDS_REPLICATION',
681                        '1.3.6.1.4.1.311.3' => ' Time Stamping',
682                        '1.3.6.1.4.1.311.3.2.1' => ' SPC_TIME_STAMP_REQUEST_OBJID',
683                        '1.3.6.1.4.1.311.30' => ' IIS',
684                        '1.3.6.1.4.1.311.31' => ' Windows updates and service packs',
685                        '1.3.6.1.4.1.311.31.1' => ' szOID_PRODUCT_UPDATE',
686                        '1.3.6.1.4.1.311.4' => ' Permissions',
687                        '1.3.6.1.4.1.311.40' => ' Fonts',
688                        '1.3.6.1.4.1.311.41' => ' Microsoft Licensing and Registration',
689                        '1.3.6.1.4.1.311.42' => ' Microsoft Corporate PKI (ITG)',
690                        '1.3.6.1.4.1.311.88' => ' CAPICOM',
691                        '1.3.6.1.4.1.311.88.1' => ' szOID_CAPICOM_VERSION',
692                        '1.3.6.1.4.1.311.88.2' => ' szOID_CAPICOM_ATTRIBUTE',
693                        '1.3.6.1.4.1.311.88.2.1' => ' szOID_CAPICOM_DOCUMENT_NAME',
694                        '1.3.6.1.4.1.311.88.2.2' => ' szOID_CAPICOM_DOCUMENT_DESCRIPTION',
695                        '1.3.6.1.4.1.311.88.3' => ' szOID_CAPICOM_ENCRYPTED_DATA',
696                        '1.3.6.1.4.1.311.88.3.1' => ' szOID_CAPICOM_ENCRYPTED_CONTENT',
697                        '1.3.6.1.5.5.7' => ' pkix',
698                        '1.3.6.1.5.5.7.1' => ' privateExtension',
699                        '1.3.6.1.5.5.7.1.1' => ' authorityInfoAccess',
700                        '1.3.6.1.5.5.7.12.2' => ' CMC Data',
701                        '1.3.6.1.5.5.7.2' => ' policyQualifierIds',
702                        '1.3.6.1.5.5.7.2.1' => ' cps',
703                        '1.3.6.1.5.5.7.2.2' => ' unotice',
704                        '1.3.6.1.5.5.7.3' => ' keyPurpose',
705                        '1.3.6.1.5.5.7.3.1' => ' serverAuth',
706                        '1.3.6.1.5.5.7.3.2' => ' clientAuth',
707                        '1.3.6.1.5.5.7.3.3' => ' codeSigning',
708                        '1.3.6.1.5.5.7.3.4' => ' emailProtection',
709                        '1.3.6.1.5.5.7.3.5' => ' ipsecEndSystem',
710                        '1.3.6.1.5.5.7.3.6' => ' ipsecTunnel',
711                        '1.3.6.1.5.5.7.3.7' => ' ipsecUser',
712                        '1.3.6.1.5.5.7.3.8' => ' timeStamping',
713                        '1.3.6.1.5.5.7.4' => ' cmpInformationTypes',
714                        '1.3.6.1.5.5.7.4.1' => ' caProtEncCert',
715                        '1.3.6.1.5.5.7.4.2' => ' signKeyPairTypes',
716                        '1.3.6.1.5.5.7.4.3' => ' encKeyPairTypes',
717                        '1.3.6.1.5.5.7.4.4' => ' preferredSymmAlg',
718                        '1.3.6.1.5.5.7.4.5' => ' caKeyUpdateInfo',
719                        '1.3.6.1.5.5.7.4.6' => ' currentCRL',
720                        '1.3.6.1.5.5.7.48.1' => ' ocsp',
721                        '1.3.6.1.5.5.7.48.2' => ' caIssuers',
722                        '1.3.6.1.5.5.8.1.1' => ' HMAC-MD5',
723                        '1.3.6.1.5.5.8.1.2' => ' HMAC-SHA',
724                        '2.16.840.1.101.2.1.1.1' => ' sdnsSignatureAlgorithm',
725                        '2.16.840.1.101.2.1.1.10' => ' mosaicKeyManagementAlgorithm',
726                        '2.16.840.1.101.2.1.1.11' => ' sdnsKMandSigAlgorithm',
727                        '2.16.840.1.101.2.1.1.12' => ' mosaicKMandSigAlgorithm',
728                        '2.16.840.1.101.2.1.1.13' => ' SuiteASignatureAlgorithm',
729                        '2.16.840.1.101.2.1.1.14' => ' SuiteAConfidentialityAlgorithm',
730                        '2.16.840.1.101.2.1.1.15' => ' SuiteAIntegrityAlgorithm',
731                        '2.16.840.1.101.2.1.1.16' => ' SuiteATokenProtectionAlgorithm',
732                        '2.16.840.1.101.2.1.1.17' => ' SuiteAKeyManagementAlgorithm',
733                        '2.16.840.1.101.2.1.1.18' => ' SuiteAKMandSigAlgorithm',
734                        '2.16.840.1.101.2.1.1.19' => ' mosaicUpdatedSigAlgorithm',
735                        '2.16.840.1.101.2.1.1.2' => ' mosaicSignatureAlgorithm',
736                        '2.16.840.1.101.2.1.1.20' => ' mosaicKMandUpdSigAlgorithms',
737                        '2.16.840.1.101.2.1.1.21' => ' mosaicUpdatedIntegAlgorithm',
738                        '2.16.840.1.101.2.1.1.22' => ' mosaicKeyEncryptionAlgorithm',
739                        '2.16.840.1.101.2.1.1.3' => ' sdnsConfidentialityAlgorithm',
740                        '2.16.840.1.101.2.1.1.4' => ' mosaicConfidentialityAlgorithm',
741                        '2.16.840.1.101.2.1.1.5' => ' sdnsIntegrityAlgorithm',
742                        '2.16.840.1.101.2.1.1.6' => ' mosaicIntegrityAlgorithm',
743                        '2.16.840.1.101.2.1.1.7' => ' sdnsTokenProtectionAlgorithm',
744                        '2.16.840.1.101.2.1.1.8' => ' mosaicTokenProtectionAlgorithm',
745                        '2.16.840.1.101.2.1.1.9' => ' sdnsKeyManagementAlgorithm',
746                        '2.16.840.1.113730.1' => ' cert-extension',
747                        '2.16.840.1.113730.1.1' => ' netscape-cert-type',
748                        '2.16.840.1.113730.1.10' => ' EntityLogo',
749                        '2.16.840.1.113730.1.11' => ' UserPicture',
750                        '2.16.840.1.113730.1.12' => ' netscape-ssl-server-name',
751                        '2.16.840.1.113730.1.13' => ' netscape-comment',
752                        '2.16.840.1.113730.1.2' => ' netscape-base-url',
753                        '2.16.840.1.113730.1.3' => ' netscape-revocation-url',
754                        '2.16.840.1.113730.1.4' => ' netscape-ca-revocation-url',
755                        '2.16.840.1.113730.1.7' => ' netscape-cert-renewal-url',
756                        '2.16.840.1.113730.1.8' => ' netscape-ca-policy-url',
757                        '2.16.840.1.113730.1.9' => ' HomePage-url',
758                        '2.16.840.1.113730.2' => ' data-type',
759                        '2.16.840.1.113730.2.1' => ' GIF',
760                        '2.16.840.1.113730.2.2' => ' JPEG',
761                        '2.16.840.1.113730.2.3' => ' URL',
762                        '2.16.840.1.113730.2.4' => ' HTML',
763                        '2.16.840.1.113730.2.5' => ' netscape-cert-sequence',
764                        '2.16.840.1.113730.2.6' => ' netscape-cert-url',
765                        '2.16.840.1.113730.3' => ' directory',
766                        '2.16.840.1.113730.4.1' => ' serverGatedCrypto',
767                        '2.16.840.1.113733.1.6.3' => ' Unknown Verisign extension',
768                        '2.16.840.1.113733.1.6.6' => ' Unknown Verisign extension',
769                        '2.16.840.1.113733.1.7.1.1' => ' Verisign certificatePolicy',
770                        '2.16.840.1.113733.1.7.1.1.1' => ' Unknown Verisign policy qualifier',
771                        '2.16.840.1.113733.1.7.1.1.2' => ' Unknown Verisign policy qualifier',
772                        '2.23.133' => ' TCPA',
773                        '2.23.133.1' => ' tcpa_specVersion',
774                        '2.23.133.2' => ' tcpa_attribute',
775                        '2.23.133.2.1' => ' tcpa_at_tpmManufacturer',
776                        '2.23.133.2.10' => ' tcpa_at_securityQualities',
777                        '2.23.133.2.11' => ' tcpa_at_tpmProtectionProfile',
778                        '2.23.133.2.12' => ' tcpa_at_tpmSecurityTarget',
779                        '2.23.133.2.13' => ' tcpa_at_foundationProtectionProfile',
780                        '2.23.133.2.14' => ' tcpa_at_foundationSecurityTarget',
781                        '2.23.133.2.15' => ' tcpa_at_tpmIdLabel',
782                        '2.23.133.2.2' => ' tcpa_at_tpmModel',
783                        '2.23.133.2.3' => ' tcpa_at_tpmVersion',
784                        '2.23.133.2.4' => ' tcpa_at_platformManufacturer',
785                        '2.23.133.2.5' => ' tcpa_at_platformModel',
786                        '2.23.133.2.6' => ' tcpa_at_platformVersion',
787                        '2.23.133.2.7' => ' tcpa_at_componentManufacturer',
788                        '2.23.133.2.8' => ' tcpa_at_componentModel',
789                        '2.23.133.2.9' => ' tcpa_at_componentVersion',
790                        '2.23.133.3' => ' tcpa_protocol',
791                        '2.23.133.3.1' => ' tcpa_prtt_tpmIdProtocol',
792                        '2.23.42.0' => ' contentType',
793                        '2.23.42.0.0' => ' PANData',
794                        '2.23.42.0.1' => ' PANToken',
795                        '2.23.42.0.2' => ' PANOnly',
796                        '2.23.42.1' => ' msgExt',
797                        '2.23.42.10' => ' national',
798                        '2.23.42.10.192' => ' Japan',
799                        '2.23.42.2' => ' field',
800                        '2.23.42.2.0' => ' fullName',
801                        '2.23.42.2.1' => ' givenName',
802                        '2.23.42.2.10' => ' amount',
803                        '2.23.42.2.2' => ' familyName',
804                        '2.23.42.2.3' => ' birthFamilyName',
805                        '2.23.42.2.4' => ' placeName',
806                        '2.23.42.2.5' => ' identificationNumber',
807                        '2.23.42.2.6' => ' month',
808                        '2.23.42.2.7' => ' date',
809                        '2.23.42.2.7.11' => ' accountNumber',
810                        '2.23.42.2.7.12' => ' passPhrase',
811                        '2.23.42.2.8' => ' address',
812                        '2.23.42.2.9' => ' telephone',
813                        '2.23.42.3' => ' attribute',
814                        '2.23.42.3.0' => ' cert',
815                        '2.23.42.3.0.0' => ' rootKeyThumb',
816                        '2.23.42.3.0.1' => ' additionalPolicy',
817                        '2.23.42.4' => ' algorithm',
818                        '2.23.42.5' => ' policy',
819                        '2.23.42.5.0' => ' root',
820                        '2.23.42.6' => ' module',
821                        '2.23.42.7' => ' certExt',
822                        '2.23.42.7.0' => ' hashedRootKey',
823                        '2.23.42.7.1' => ' certificateType',
824                        '2.23.42.7.2' => ' merchantData',
825                        '2.23.42.7.3' => ' cardCertRequired',
826                        '2.23.42.7.4' => ' tunneling',
827                        '2.23.42.7.5' => ' setExtensions',
828                        '2.23.42.7.6' => ' setQualifier',
829                        '2.23.42.8' => ' brand',
830                        '2.23.42.8.1' => ' IATA-ATA',
831                        '2.23.42.8.30' => ' Diners',
832                        '2.23.42.8.34' => ' AmericanExpress',
833                        '2.23.42.8.4' => ' VISA',
834                        '2.23.42.8.5' => ' MasterCard',
835                        '2.23.42.8.6011' => ' Novus',
836                        '2.23.42.9' => ' vendor',
837                        '2.23.42.9.0' => ' GlobeSet',
838                        '2.23.42.9.1' => ' IBM',
839                        '2.23.42.9.10' => ' Griffin',
840                        '2.23.42.9.11' => ' Certicom',
841                        '2.23.42.9.12' => ' OSS',
842                        '2.23.42.9.13' => ' TenthMountain',
843                        '2.23.42.9.14' => ' Antares',
844                        '2.23.42.9.15' => ' ECC',
845                        '2.23.42.9.16' => ' Maithean',
846                        '2.23.42.9.17' => ' Netscape',
847                        '2.23.42.9.18' => ' Verisign',
848                        '2.23.42.9.19' => ' BlueMoney',
849                        '2.23.42.9.2' => ' CyberCash',
850                        '2.23.42.9.20' => ' Lacerte',
851                        '2.23.42.9.21' => ' Fujitsu',
852                        '2.23.42.9.22' => ' eLab',
853                        '2.23.42.9.23' => ' Entrust',
854                        '2.23.42.9.24' => ' VIAnet',
855                        '2.23.42.9.25' => ' III',
856                        '2.23.42.9.26' => ' OpenMarket',
857                        '2.23.42.9.27' => ' Lexem',
858                        '2.23.42.9.28' => ' Intertrader',
859                        '2.23.42.9.29' => ' Persimmon',
860                        '2.23.42.9.3' => ' Terisa',
861                        '2.23.42.9.30' => ' NABLE',
862                        '2.23.42.9.31' => ' espace-net',
863                        '2.23.42.9.32' => ' Hitachi',
864                        '2.23.42.9.33' => ' Microsoft',
865                        '2.23.42.9.34' => ' NEC',
866                        '2.23.42.9.35' => ' Mitsubishi',
867                        '2.23.42.9.36' => ' NCR',
868                        '2.23.42.9.37' => ' e-COMM',
869                        '2.23.42.9.38' => ' Gemplus',
870                        '2.23.42.9.4' => ' RSADSI',
871                        '2.23.42.9.5' => ' VeriFone',
872                        '2.23.42.9.6' => ' TrinTech',
873                        '2.23.42.9.7' => ' BankGate',
874                        '2.23.42.9.8' => ' GTE',
875                        '2.23.42.9.9' => ' CompuSource',
876                        '2.5.29.1' => ' authorityKeyIdentifier',
877                        '2.5.29.10' => ' basicConstraints',
878                        '2.5.29.11' => ' nameConstraints',
879                        '2.5.29.12' => ' policyConstraints',
880                        '2.5.29.13' => ' basicConstraints',
881                        '2.5.29.14' => ' subjectKeyIdentifier',
882                        '2.5.29.15' => ' keyUsage',
883                        '2.5.29.16' => ' privateKeyUsagePeriod',
884                        '2.5.29.17' => ' subjectAltName',
885                        '2.5.29.18' => ' issuerAltName',
886                        '2.5.29.19' => ' basicConstraints',
887                        '2.5.29.2' => ' keyAttributes',
888                        '2.5.29.20' => ' cRLNumber',
889                        '2.5.29.21' => ' cRLReason',
890                        '2.5.29.22' => ' expirationDate',
891                        '2.5.29.23' => ' instructionCode',
892                        '2.5.29.24' => ' invalidityDate',
893                        '2.5.29.26' => ' issuingDistributionPoint',
894                        '2.5.29.27' => ' deltaCRLIndicator',
895                        '2.5.29.28' => ' issuingDistributionPoint',
896                        '2.5.29.29' => ' certificateIssuer',
897                        '2.5.29.3' => ' certificatePolicies',
898                        '2.5.29.30' => ' nameConstraints',
899                        '2.5.29.31' => ' cRLDistributionPoints',
900                        '2.5.29.32' => ' certificatePolicies',
901                        '2.5.29.33' => ' policyMappings',
902                        '2.5.29.34' => ' policyConstraints',
903                        '2.5.29.35' => ' authorityKeyIdentifier',
904                        '2.5.29.36' => ' policyConstraints',
905                        '2.5.29.37' => ' extKeyUsage',
906                        '2.5.29.4' => ' keyUsageRestriction',
907                        '2.5.29.5' => ' policyMapping',
908                        '2.5.29.6' => ' subtreesConstraint',
909                        '2.5.29.7' => ' subjectAltName',
910                        '2.5.29.8' => ' issuerAltName',
911                        '2.5.29.9' => ' subjectDirectoryAttributes',
912                        '2.5.4.0' => ' objectClass',
913                        '2.5.4.1' => ' aliasObjectName',
914                        '2.5.4.12' => ' title',
915                        '2.5.4.13' => ' description',
916                        '2.5.4.14' => ' searchGuide',
917                        '2.5.4.15' => ' businessCategory',
918                        '2.5.4.16' => ' postalAddress',
919                        '2.5.4.17' => ' postalCode',
920                        '2.5.4.18' => ' postOfficeBox',
921                        '2.5.4.19' => ' physicalDeliveryOfficeName',
922                        '2.5.4.2' => ' knowledgeInformation',
923                        '2.5.4.20' => ' telephoneNumber',
924                        '2.5.4.21' => ' telexNumber',
925                        '2.5.4.22' => ' teletexTerminalIdentifier',
926                        '2.5.4.23' => ' facsimileTelephoneNumber',
927                        '2.5.4.24' => ' x121Address',
928                        '2.5.4.25' => ' internationalISDNNumber',
929                        '2.5.4.26' => ' registeredAddress',
930                        '2.5.4.27' => ' destinationIndicator',
931                        '2.5.4.28' => ' preferredDeliveryMehtod',
932                        '2.5.4.29' => ' presentationAddress',
933                        '2.5.4.30' => ' supportedApplicationContext',
934                        '2.5.4.31' => ' member',
935                        '2.5.4.32' => ' owner',
936                        '2.5.4.33' => ' roleOccupant',
937                        '2.5.4.34' => ' seeAlso',
938                        '2.5.4.35' => ' userPassword',
939                        '2.5.4.36' => ' userCertificate',
940                        '2.5.4.37' => ' caCertificate',
941                        '2.5.4.38' => ' authorityRevocationList',
942                        '2.5.4.39' => ' certificateRevocationList',
943                        '2.5.4.40' => ' crossCertificatePair',
944                        '2.5.4.41' => ' givenName',
945                        '2.5.4.42' => ' givenName',
946                        '2.5.4.5' => ' serialNumber',
947                        '2.5.4.52' => ' supportedAlgorithms',
948                        '2.5.4.53' => ' deltaRevocationList',
949                        '2.5.4.58' => ' crossCertificatePair',
950                        '2.5.4.9' => ' streetAddress',
951                        '2.5.8' => ' X.500-Algorithms',
952                        '2.5.8.1' => ' X.500-Alg-Encryption',
953                        '2.5.8.1.1' => ' rsa',
954                        '2.16.76.1.1' => 'DPC',
955                        '2.16.76.1.1.0' => 'DPC da AC Raiz',
956                        '2.16.76.1.1.1' => 'DPC da AC Presidência',
957                        '2.16.76.1.1.2' => 'DPC da AC Serpro',
958                        '2.16.76.1.1.3' => 'DPC da SERASA Autoridade Certificadora Principal - ACP',
959                        '2.16.76.1.1.4' => 'DPC da SERASA Autoridade Certificadora - AC',
960                        '2.16.76.1.1.5' => 'DPC da AC CertiSign na ICP­Brasil',
961                        '2.16.76.1.1.6' => 'DPC da AC CertiSign SPB na ICP­Brasil',
962                        '2.16.76.1.1.7' => 'DPC da SERASA Certificadora Digital',
963                        '2.16.76.1.1.8' => 'DPC da AC SRF',
964                        '2.16.76.1.1.9' => 'DPC da AC CAIXA',
965                        '2.16.76.1.1.10' => 'DPC da AC CAIXA IN',
966                        '2.16.76.1.1.11' => 'DPC da AC CAIXA PJ',
967                        '2.16.76.1.1.12' => 'DPC da AC CAIXA PF',
968                        '2.16.76.1.1.13' => 'DPC da AC SERPRO SRF',
969                        '2.16.76.1.1.14' => 'DPC da Autoridade Certificadora CertiSign Múltipla',
970                        '2.16.76.1.1.15' => 'DPC da Autoridade Certificadora CertiSign para Secretaria da Receita Federal',
971                        '2.16.76.1.1.16' => 'DPC da AC SERASA SRF',
972                        '2.16.76.1.1.17' => 'DPC da Autoridade Certificadora Imprensa Oficial ­ SP',
973                        '2.16.76.1.1.18' => 'DPC da Autoridade Certificadora PRODEMGE',
974                        '2.16.76.1.1.19' => 'DPC da Autoridade Certificadora do Sistema Justiça Federal - AC­JUS',
975                        '2.16.76.1.1.20' => 'Declaração   de   Práticas   de   Certificação   da   Autoridade   Certificadora   do SERPRO Final - DPC SERPRO ACF',
976                        '2.16.76.1.1' => 'DPC',
977                        '2.16.76.1.1.21' => 'Declaração de Práticas de Certificação da Autoridade Certificadora SINCOR',
978                        '2.16.76.1.1.22' => 'Declaração de Práticas de Certificação da Autoridade Certificadora Imprensa Oficial SP SRF',
979                        '2.16.76.1.1.23' => 'Declaração de Práticas de Certificação da AC FENACOR',
980                        '2.16.76.1.1.24' => 'Declaração de Práticas de Certificação da Autoridade Certificadora SERPRO­ JUS',
981                        '2.16.76.1.1.25' => 'DPC da AC Caixa Justiça',
982                        '2.16.76.1.1.26' => 'DPC da Autoridade Certificadora Imprensa Oficial SP (AC IMESP)',
983                        '2.16.76.1.1.27' => 'DPC da Autoridade Certificadora PRODEMGE SRF',
984                        '2.16.76.1.1.28' => 'Declaração de Práticas de Certificação da Autoridade Certificadora CertSign  para a Justiça',
985                        '2.16.76.1.1.29' => 'DPC da AC SERASA JUS',
986                        '2.16.76.1.2' => 'PC',
987                        '2.16.76.1.2.1' => 'A1',
988                        '2.16.76.1.2.1.1' => 'Política de Certificados da ACSERPRO para certificados SERPRO­SPB ­ PC SERPRO­SPB',
989                        '2.16.76.1.2.1.2' => 'Política de Certificados para certificados da SERASA Autoridade Certificadora',
990                        '2.16.76.1.2.1.3' => 'Política   de   Certificados   da   Autoridade   Certificadora   da   Presidência   da República - PCA1',
991                        '2.16.76.1.2.1.4' => 'Política   de   Certificado   da   Autoridade   Certificadora   CertiSign   Certificadora Digital para o Sistema de Pagamentos Brasileiro na ICP­Brasil­ PC da AC CertiSign SPB na ICP­Brasil',
992                        '2.16.76.1.2.1.5' => 'Política de Certificados SEPROA1',
993                        '2.16.76.1.2.1.6' => 'Política de Certificado Digital para Certificado de Assinatura Digital Tipo A1 -  SERASA CD',
994                        '2.16.76.1.2.1.7' => 'Política de Certificado de Assinatura Digital do Tipo A1 da AC Caixa IN',
995                        '2.16.76.1.2.1.8' => 'Política de Certificado de Assinatura Digital do Tipo A1 da AC Caixa PF',
996                        '2.16.76.1.2.1.9' => 'Política de Certificado de Assinatura Digital do Tipo A1 da AC Caixa PJ',
997                        '2.16.76.1.2.1.10' => 'Política de Certificados  da  Autoridade  Certificadora  do  Serpro­SRF  para certificados de assinatura digital do tipo A1 (PCSerpro­SRFA1)',
998                        '2.16.76.1.2.1.11' => 'Política de  Certificado de  Assinatura Digital do Tipo  A1 da  Autoridade  Certificadora  CertiSign  Múltipla  na  Infra­estrutura  de  Chaves  Públicas  Brasileira',
999                        '2.16.76.1.2.1.12' => 'Política  de  Certificado  de   Assinatura   Digital   Tipo   A1   da   Autoridade  Certificadora CertiSign para a Secretaria da Receita Federal',
1000                        '2.16.76.1.2.1.13' => 'Política de Certificado de Assinatura Digital Tipo A1 da AC SERASA SRF',
1001                        '2.16.76.1.2.1.14' => 'Política  de Certificado  de  Assinatura   Digital   Tipo  A1  da  Autoridade Certificadora Imprensa Oficial ­ SP',
1002                        '2.16.76.1.2.1.15' => 'Política  de  Certificado  de  Assinatura   Digital  Tipo  A1  da  Autoridade  Certificadora PRODEMGE',
1003                        '2.16.76.1.2.1.16' => 'Política de Certificados SERPRO do Tipo A1 - PC SERPRO ACF A1',
1004                        '2.16.76.1.2.1.17' => 'Política de Certificados do SERPRO - SPB - PC SERPRO ACF SPB',
1005                        '2.16.76.1.2.1.18' => 'Política  de  Certificado  de  Assinatura  Digital  Tipo  A1  da  Autoridade Certificadora SINCOR',
1006                        '2.16.76.1.2.1.19' => 'Política de Certificado  de  Assinatura  Digital  Tipo  A1  da  Autoridade Certificadora SINCOR para Corretores de Seguros',
1007                        '2.16.76.1.2' => 'PC',
1008                        '2.16.76.1.2.1' => 'A1',
1009                        '2.16.76.1.2.1.20' => 'Política  de  Certificado  de  Assinatura  Digital  Tipo  A1  da  Autoridade Certificadora Imprensa Oficial SP SRF',
1010                        '2.16.76.1.2.1.21' => 'Política de Certificados SERPRO­JUS do tipo A1 ­ PCSERPROJUSA1',
1011                        '2.16.76.1.2.1.22' => 'Política de Certificado de Assinatura Digital do Tipo A1 da AC Caixa Justiça',
1012                        '2.16.76.1.2.1.23' => 'Política  de Certificado de  Assinatura  Tipo  A1 da  Autoridade  Certificadora PRODEMGE SRF',
1013                        '2.16.76.1.2.1.24' => 'Política de Certificado de Assinatura Digital Tipo A1 da Autoridade Certificadora CertiSign para a Justiça',
1014                        '2.16.76.1.2.1.25' => 'Política de Certificado Digital da AC  SERASA­JUS para Certificados Tipo A1',
1015                        '2.16.76.1.2' => 'PC',
1016                        '2.16.76.1.2.2' => 'A2',
1017                        '2.16.76.1.2.2.1' => 'Política de Certificado Digital para Certificado de Assinatura Digital  Tipo A2 - SERASA CD',
1018                        '2.16.76.1.2.2.2' => 'Política de Certificado Digital para Certificado de Assinatura Digital Tipo A2 da AC SERASA SRF',
1019                        '2.16.76.1.2.2.3' => 'Política  de  Certificado  de  Assinatura  Digital   do  Tipo  A2  da  Autoridade  Certificadora  CertiSign  últipla  na  Infra­estrutura  de Chaves Públicas Brasileira',
1020                        '2.16.76.1.2.2.4' => 'Política  de  Certificado  de  Assinatura  Digital  do Tipo  A2  da Autoridade Certificadora Imprensa Oficial ­ SP',
1021                        '2.16.76.1.2.2.5' => 'Política de Certificado de Assinatura Digital do Tipo A2 da AC Caixa Justiça',
1022                        '2.16.76.1.2.2.6' => 'Política de Certificado de Assinatura Digital Tipo A2 da Autoridade Certificadora CertiSign para a Justiça',
1023                        '2.16.76.1.2.2.7' => 'Política de Certificado  Digital da  AC SERASA­JUS para Certificados Tipo A2',
1024                        '2.16.76.1.2' => 'PC',
1025                        '2.16.76.1.2.3' => 'A3',
1026                        '2.16.76.1.2.3.1' => 'Política de Certificados da Autoridade Certificadora da Presidência da República - PC ACPR',
1027                        '2.16.76.1.2.3.2' => 'Política  de  Certificados   da  Autoridade  Certificadora do  SERPRO para certificados SERPRO do tipo A3 - PCSERPROA3',
1028                        '2.16.76.1.2.3.3' => 'Política de Certificado Digital para Certificado de Assinatura Digital Tipo A3 - SERASA CD',
1029                        '2.16.76.1.2.3.4' => 'Política de Certificados da Autoridade Certificadora do Serpro­SRF para certificados de assinatura digital do tipo A3 (PCSerpro­SRFA3)',
1030                        '2.16.76.1.2.3.5' => 'Política de Certificado de Assinatura Digital do Tipo A3 da  Autoridade Certificadora CertiSign Múltipla na Infra­estrutura de Chaves Públicas Brasileira',
1031                        '2.16.76.1.2.3.6' => 'Política de Certificado de Assinatura Digital Tipo A3 da Autoridade Certificadora CertiSign para a Secretaria da Receita Federal na Infra­estrutura de Chaves Públicas Brasileira',
1032                        '2.16.76.1.2.3.7' => 'Política de Certificado de Assinatura Digital do Tipo A3 da AC Caixa  IN',
1033                        '2.16.76.1.2.3.8' => 'Política de Certificado de Assinatura Digital do Tipo A3 da AC Caixa  PF',
1034                        '2.16.76.1.2.3.9' => 'Política de Certificado de Assinatura Digital do Tipo A3 da AC Caixa   PJ',
1035                        '2.16.76.1.2.3.10' => 'Política de Certificado de Assinatura Digital do Tipo A3 da AC SERASA SRF',
1036                        '2.16.76.1.2.3.11' => 'Política de Certificado de Assinatura Digital do Tipo A3 da  Autoridade Certificadora  Imprensa Oficial ­ SP',
1037                        '2.16.76.1.2.3.12' => 'Política de Certificado de Assinatura Digital do Tipo A3 da  Autoridade Certificadora PRODEMGE',
1038                        '2.16.76.1.2.3.13' => 'Política de Certificados SERPRO do Tipo A3 - PC SERPRO A3',
1039                        '2.16.76.1.2.3.14' => 'Política de Certificado de Assinatura Digital Tipo A3 da Autoridade Certificadora SINCOR',
1040                        '2.16.76.1.2.3.15' => 'Política de Certificado de Assinatura Digital Tipo A3 da Autoridade  Certificadora SINCOR para Corretores de Seguros',
1041                        '2.16.76.1.2.3.16' => 'Política de Certificado de Assinatura Digital Tipo A3 da Autoridade  Certificadora Imprensa Oficial SP SRF',
1042                        '2.16.76.1.2' => 'PC',
1043                        '2.16.76.1.2.3' => 'A3',
1044                        '2.16.76.1.2.3.17' => 'Política de Certificado da AC FENACOR A3',
1045                        '2.16.76.1.2.3.18' => 'Política  de  Certificados  SERPRO­JUS  do  tipo  A3 PCSERPROJUSA3',
1046                        '2.16.76.1.2.3.19' => 'Política de Certificado de Assinatura Digital do Tipo A3 da AC Caixa Justiça',
1047                        '2.16.76.1.2.3.20' => 'Política  de  Certificado  de  Assinatura   Tipo   A3   da   Autoridade Certificadora PRODEMGE SRF',
1048                        '2.16.76.1.2.3.21' => 'Política de Certificado de Assinatura Digital Tipo A3 da Autoridade  Certificadora CertiSign para a Justiça',
1049                        '2.16.76.1.2.3.22' => 'Política   de   Certificado   Digital   da   AC     SERASA­JUS   para Certificados Tipo A3',
1050                        '2.16.76.1.2' => 'PC',
1051                        '2.16.76.1.2.4' => 'A4',
1052                        '2.16.76.1.2.4.1' => 'Política de Certificado Digital para Certificado de Assinatura Digital  Tipo A4 - SERASA CD;',
1053                        '2.16.76.1.2.4.2' => 'VAGO',
1054                        '2.16.76.1.2.4.3' => 'Política de Certificado de Assinatura Digital do Tipo A4 da  Autoridade Certificadora CertiSign Múltipla na Infra­estrutura de Chaves Públicas Brasileira',
1055                        '2.16.76.1.2.4.4' => 'Política de Certificado de Assinatura Digital Tipo A4 da Autoridade Certificadora CertiSign para a Secretaria da Receita Federal na Infra­estrutura de Chaves Públicas Brasileira',
1056                        '2.16.76.1.2.4.5' => 'Política de Certificado de Assinatura Digital Tipo A4 da Autoridade Certificadora Imprensa Oficial ­ SP',
1057                        '2.16.76.1.2.4.6' => 'Política de Certificado de Assinatura Digital Tipo A4 da Autoridade Certificadora Imprensa Oficial - SP SRF',
1058                        '2.16.76.1.2.4.7' => 'Política   de   Certificado   de   Assinatura   Tipo   A4   da   Autoridade Certificadora PRODEMGE SRF',
1059                        '2.16.76.1.2.4.8' => 'Política de Certificado de Assinatura Digital Tipo A4 da Autoridade Certificadora CertiSign para a Justiça',
1060                        '2.16.76.1.2.4.9' => 'VAGO',
1061                        '2.16.76.1.2.4.10' => 'Política de Certificado Digital  a  AC SERASA­JUS  para Certificados Tipo A4',
1062                        '2.16.76.1.2' => 'PC',
1063                        '2.16.76.1.2.101' => 'S1',
1064                        '2.16.76.1.2.101.1' => 'Política de Certificado Digital para Certificado de Sigilo Tipo S1 -  SERASA CD',
1065                        '2.16.76.1.2.101.2' => 'Política de Certificado de Sigilo Tipo S1 da Autoridade Certificadora Imprensa Oficial ­ SP',
1066                        '2.16.76.1.2.101.3' => 'Política  de  Certificado  de  Sigilo  do  Tipo  S1  da   Autoridade Certificadora CertiSign Múltipla',
1067                        '2.16.76.1.2.101.4' => 'Política   de   Certificado   de   Sigilo   do   Tipo   S1   da   Autoridade Certificadora PRODEMGE',
1068                        '2.16.76.1.2.101.5' => 'Política de Certificado de Assinatura Digital do Tipo S1 da AC Caixa Justiça',
1069                        '2.16.76.1.2.101.6' => 'Política de Certificado de Assinatura Digital Tipo S1 da Autoridade Certificadora CertiSign para a Justiça',
1070                        '2.16.76.1.2.101.7' => 'Política   de   Certificado   Digital   da   AC     SERASA­JUS   para Cerficados Tipo S1',
1071                        '2.16.76.1.2' => 'PC',
1072                        '2.16.76.1.2.102' => 'S2',
1073                        '2.16.76.1.2.102.1' => 'Política de Certificado Digital para Certificado de Sigilo Tipo S2 - SERASA CD',
1074                        '2.16.76.1.2.102.2' => 'Política de Certificado de Sigilo Tipo S2 da Autoridade Certificadora Imprensa Oficial ­ SP',
1075                        '2.16.76.1.2.102.3' => 'Política   de   Certificado   de   Sigilo   do   Tipo   S2   da   Autoridade Certificadora CertiSign Múltipla',
1076                        '2.16.76.1.2.102.4' => 'Política de Certificado de Assinatura Digital do Tipo S2 da AC Caixa Justiça',
1077                        '2.16.76.1.2.102.5' => 'Política de Certificado de Assinatura Digital Tipo S2 da Autoridade Certificadora CertiSign para a Justiça',
1078                        '2.16.76.1.2.102.6' => 'Política  de  Certificado  Digital  da   AC  SERASA­JUS   para Certificados Tipo S2',
1079                        '2.16.76.1.2' => 'PC',
1080                        '2.16.76.1.2.103' => 'S3',
1081                        '2.16.76.1.2.103.1' => 'Política de Certificado Digital para Certificado de Sigilo Tipo S3 -  SERASA CD',
1082                        '2.16.76.1.2.103.2' => 'VAGO',
1083                        '2.16.76.1.2.103.3' => 'Política   de   Certificado   de   Sigilo   do   Tipo   S3   da   Autoridade Certificadora CertiSign Múltipla',
1084                        '2.16.76.1.2.103.4' => 'Política de Certificado de Sigilo Tipo S3 da Autoridade Certificadora Imprensa Oficial ­ SP',
1085                        '2.16.76.1.2.103.5' => 'Política de Certificado de Sigilo Tipo S3 da Autoridade Certificadora PRODEMGE',
1086                        '2.16.76.1.2.103.6' => 'Política de Certificado de Assinatura Digital do Tipo S3 da AC Caixa Justiça',
1087                        '2.16.76.1.2.103.7' => 'Política de Certificado de Assinatura Digital Tipo S3 da Autoridade Certificadora CertiSign para a Justiça',
1088                        '2.16.76.1.2.103.8' => 'Política   de   Certificado   Digital   da   AC     SERASA­JUS   para Certificados Tipo S3',
1089                        '2.16.76.1.2' => 'PC',
1090                        '2.16.76.1.2.104' => 'S4',
1091                        '2.16.76.1.2.104.1' => 'Política de Certificado Digital para Certificado de Sigilo Tipo S4 - SERASA CD',
1092                        '2.16.76.1.2.104.2' => 'VAGO',
1093                        '2.16.76.1.2.104.3' => 'Política   de   Certificado   de   Sigilo   do   Tipo   S4   da   Autoridade Certificadora CertiSign Múltipla',
1094                        '2.16.76.1.2.104.4' => 'Política de Certificado de Sigilo Tipo S4 da Autoridade Certificadora Imprensa Oficial ­ SP',
1095                        '2.16.76.1.2.104.5' => 'Política de Certificado de Assinatura Digital Tipo S4 da Autoridade Certificadora CertiSign para a Justiça',
1096                        '2.16.76.1.2.104.6' => 'Política   de   Certificado   Digital   da   AC     SERASA­JUS   para Certificados Tipo S4',
1097                        '2.16.76.1.2' => 'PC',
1098                        '2.16.76.1.2.201' => 'PC de AC',
1099                        '2.16.76.1.2.201.1' => 'PC da Serasa Autoridade Certificadora Principal - ACP',
1100                        '2.16.76.1.2.201.2' => 'PC da AC CertiSign na ICP­Brasil',
1101                        '2.16.76.1.2.201.3' => 'PC da AC SRF',
1102                        '2.16.76.1.2.201.4' => 'Política de Certificados da Autoridade Certificadora Caixa',
1103                        '2.16.76.1.2.201.5' => 'PC da Autoridade Certificadora do Sistema Justiça Federal - AC­ JUS',
1104                        '2.16.76.1.2.201.6' => 'PC da Autoridade Certificadora do SERPRO (AC SERPRO)',
1105                        '2.16.76.1.2.201.7' => 'PC da Autoridade Certificadora Imprensa Oficial SP (AC IMESP)',
1106                        '2.16.76.1.3' => 'Atributos Obrigatórios de Certificados',
1107                        '2.16.76.1.3.1' => 'campo otherName em certificado de pessoa física',
1108                        '2.16.76.1.3.2' => 'campo otherName em certificado de pessoa  jurídica',
1109                        '2.16.76.1.3.3' => 'campo otherName em certificado de pessoa  jurídica',
1110                        '2.16.76.1.3.4' => 'campo otherName em certificado de pessoa jurídica',
1111                        '2.16.76.1.3.5' => 'campo otherName em certificado de pessoa física',
1112                        '2.16.76.1.3.6' => 'campo otherName em certificado de pessoa física',
1113                        '2.16.76.1.3.7' => 'campo otherName em certificado de pessoa jurídica',
1114                        '2.16.76.1.4' => 'Atributos Opcionais de  Certificados',
1115                        '2.16.76.1.4.1' => 'Entidades Sindicais',
1116                        '2.16.76.1.4.1.1' => 'SINCOR',
1117                        '2.16.76.1.4.1.1.1' => 'Número de registro do corretor associado');
1118
1119
1120                $result = array();
1121               
1122                while (strlen($data) > 1)
1123                {
1124                        $class = ord($data[0]);
1125                        switch ($class)
1126                        {
1127                                case 0x30:
1128                                        // Sequence
1129                                        $len = ord($data[1]);
1130                                        $bytes = 0;
1131                                        get_length(&$len,&$bytes,$data);
1132                                        $sequence_data = substr($data, 2 + $bytes, $len);
1133                                        $data = substr($data, 2 + $bytes + $len);
1134                                        $values = Crl_parseASN($sequence_data);
1135                                        if (!is_array($values) || is_string($values[0]))
1136                                        {
1137                                                $values = array($values);
1138                                        }
1139                                        $result[] = array('sequence (' . $len . ')' , $values);
1140                                        break;
1141
1142                                case 0x31:
1143                                        // Set of
1144                                        $len = ord($data[1]);
1145                                        $bytes = 0;
1146                                        get_length(&$len,&$bytes,$data);
1147                                        $sequence_data = substr($data, 2 + $bytes, $len);
1148                                        $data = substr($data, 2 + $bytes + $len);
1149                                        $result[] = array('set (' . $len . ')' , Crl_parseASN($sequence_data));
1150                                        break;
1151
1152                                case 0x01:
1153                                        // Boolean type
1154                                        $boolean_value = (ord($data[2]) == 0xff);
1155                                        $data = substr($data, 3);
1156                                        $result[] = array('boolean (1)' , $boolean_value);
1157                                        break;
1158                               
1159                                case 0x02:
1160                                        // Integer type
1161                                        $len = ord($data[1]);
1162                                        $bytes = 0;
1163                                        get_length(&$len,&$bytes,$data);
1164                                        $integer_data = substr($data, 2 + $bytes, $len);
1165                                        $data = substr($data, 2 + $bytes + $len);
1166                                        if($len == 16)
1167                                        {
1168                                                $result[] = array('integer(' . $len . ')', $integer_data);
1169                                                break;
1170                                        }
1171                                        else
1172                                        {
1173                                                $value = 0;
1174                                                if ($len <= 4)
1175                                                {
1176                                                        // Method works fine for small integers
1177                                                        for ($i = 0; $i < strlen($integer_data); $i++)
1178                                                        {
1179                                                                $value = ($value << 8) | ord($integer_data[$i]);
1180                                                        }
1181                                                }
1182                                                else
1183                                                {
1184                                                        // Method works for arbitrary length integers
1185                                                        if (extension_loaded('bcmath'))
1186                                                        {
1187                                                                for ($i = 0; $i < strlen($integer_data); $i++)
1188                                                                {
1189                                                                        $value = bcadd(bcmul($value, 256), ord($integer_data[$i]));
1190                                                                }
1191                                                        }
1192                                                        else
1193                                                        {
1194                                                                $value = -1;
1195                                                        }
1196                                                }
1197                                                $result[] = array('integer(' . $len . ')', $value);
1198                                                break;
1199                                        }
1200
1201                                case 0x03:
1202                                        // Bitstring type
1203                                        $len = ord($data[1]);
1204                                        $bytes = 0;
1205                                        get_length(&$len,&$bytes,$data);
1206                                        $bitstring_data = substr($data, 2+bytes ,  $len);
1207                                        $data = substr($data, 2 + $bytes + $len);
1208                                        //$result[] = array('bit string (' . $len . ')' ,Crl_parseASN($bitstring_data));
1209                                        $result[] = array('bit string (' . $len . ')' ,'UnsedBits:'.ord($bitstring_data[0]).':'.ord($bitstring_data[1]));
1210                                        break;
1211
1212                                case 0x04:
1213                                        // Octetstring type
1214                                        $len = ord($data[1]);
1215                                        $bytes = 0;
1216                                        get_length(&$len,&$bytes,$data);
1217                                        $octectstring_data = substr($data, 2 + $bytes, $len);
1218                                        $data = substr($data, 2 + $bytes + $len);
1219                                        if($context_especific)
1220                                        {
1221                                                $result[] = array('octet string(' . $len . ')'  , $octectstring_data);
1222                                        }
1223                                        else
1224                                        {
1225                                                $result[] = array('octet string (' . $len . ')' , Crl_parseASN($octectstring_data));
1226                                        }
1227                                        break;
1228
1229                                case 0x05:
1230                                        // Null type
1231                                        $data = substr($data, 2);
1232                                        $result[] = array('null', null);
1233                                        break;
1234
1235                                case 0x06:
1236                                        // Object identifier type
1237                                        $len = ord($data[1]);
1238                                        $bytes = 0;
1239                                        get_length(&$len,&$bytes,$data);
1240                                        $oid_data = substr($data, 2 + $bytes, $len);
1241                                        $x_len = $data[1];
1242                                        $data = substr($data, 2 + $bytes + $len);
1243
1244                                        // Unpack the OID
1245                                        $plain  = floor(ord($oid_data[0]) / 40);
1246                                        $plain .= '.' . ord($oid_data[0]) % 40;
1247
1248                                        $value = 0;
1249                                        $i = 1;
1250                                        while ($i < strlen($oid_data))
1251                                        {
1252                                                $value = $value << 7;
1253                                                $value = $value | (ord($oid_data[$i]) & 0x7f);
1254
1255                                                if (!(ord($oid_data[$i]) & 0x80))
1256                                                {
1257                                                        $plain .= '.' . $value;
1258                                                        $value = 0;
1259                                                }
1260                                                $i++;
1261                                        }
1262
1263                                        if (isset($_oids[$plain]))
1264                                        {
1265                                                $result[] =  array('oid(' . $len . '): '  . $plain, $_oids[$plain]);
1266                                        }
1267                                        else
1268                                        {
1269                                                $result[] = array('oid(' . $len . '): '  . $plain, $plain);
1270                                        }
1271                                        break;
1272
1273                                case 0x16:
1274                                        // Character string type
1275                                        $len = ord($data[1]);
1276                                        $bytes = 0;
1277                                        get_length(&$len,&$bytes,$data);
1278                                        $string_data = substr($data, 2 + $bytes, $len);
1279                                        $data = substr($data, 2 + $bytes + $len);
1280                                        $result[] = array('IA5 String (' . $len . ')'  , $string_data);
1281                                        break;
1282                                       
1283                                case 0x12:
1284                                case 0x14:
1285                                case 0x15:     
1286                                case 0x81:                     
1287                                        // Character string type
1288                                        $len = ord($data[1]);
1289                                        $bytes = 0;
1290                                        get_length(&$len,&$bytes,$data);
1291                                        $string_data = substr($data, 2 + $bytes, $len);
1292                                        $data = substr($data, 2 + $bytes + $len);
1293                                        $result[] = array('string (' . $len . ')'  , $string_data);
1294                                        break;
1295
1296                                case 0x80:
1297                                        // Character string type
1298                                        $len = ord($data[1]);
1299                                        $bytes = 0;
1300                                        get_length(&$len,&$bytes,$data);
1301                                        $string_data = substr($data, 2 + $bytes, $len);
1302                                        $data = substr($data, 2 + $bytes + $len);
1303                                        $result[] = array('string (' . $len . ')'  , print_hex($string_data));
1304                                        break;
1305                                       
1306                                case 0x13:
1307                                case 0x86:
1308                                        // Printable string type
1309                                        $len = ord($data[1]);
1310                                        $bytes = 0;
1311                                        get_length(&$len,&$bytes,$data);
1312                                        $string_data = substr($data, 2 + $bytes, $len);
1313                                        $data = substr($data, 2 + $bytes + $len);
1314                                        $result[] = array('Printable String (' . $len . ')'  , $string_data);
1315                                        break;
1316
1317                                case 0x17:
1318                                        // Time types
1319                                        $len = ord($data[1]);
1320                                        $bytes = 0;
1321                                        get_length(&$len,&$bytes,$data);
1322                                        $time_data = substr($data, 2 + $bytes, $len);
1323                                        $data = substr($data, 2 + $bytes + $len);
1324                                        $result[] = array('utctime (' . $len . ')'  , $time_data);
1325                                        break;
1326
1327                                case 0x82:
1328                                        // X509v3 extensions?
1329                                        $len = ord($data[1]);
1330                                        $bytes = 0;
1331                                        get_length(&$len,&$bytes,$data);
1332                                        $sequence_data = substr($data, 2 + $bytes, $len);
1333                                        $data = substr($data, 2 + $bytes + $len);
1334                                        $result[] = array('extension : X509v3 extensions (' . $len . ')'  , array(Crl_parseASN($sequence_data)));
1335                                        //$result[] = Crl_parseASN($sequence_data);
1336                                        break;
1337
1338                                case 0xa0:
1339                                        // Extensions
1340                                        $len = ord($data[1]);
1341                                        $bytes = 0;
1342                                        get_length(&$len,&$bytes,$data);
1343                                        $extension_data = substr($data, 2 + $bytes, $len);
1344                                        $data = substr($data, 2 + $bytes + $len);
1345                                        $result[] = array('Context Especific (' . $len . ')' , array(Crl_parseASN($extension_data,true)));
1346                                        break;
1347                                       
1348                                case 0xa3:
1349                                        // Extensions
1350                                        $len = ord($data[1]);
1351                                        $bytes = 0;
1352                                        get_length(&$len,&$bytes,$data);
1353                                        $extension_data = substr($data, 2 + $bytes, $len);
1354                                        $data = substr($data, 2 + $bytes + $len);
1355                                        $result[] = array('extension (0xA3)  (' . $len . ')' ,array(Crl_parseASN($extension_data)));
1356                                        break;
1357
1358                                case 0xe6:
1359                                        $extension_data = substr($data, 0, 1);
1360                                        $data = substr($data, 1);
1361                                        $result[] = array('extension (0xE6) (' . $len . ')'  , dechex($extension_data));
1362                                        break;
1363
1364                                case 0xa1:
1365                                        $extension_data = substr($data, 0, 1);
1366                                        $data = substr($data, 6);
1367                                        $result[] = array('extension (0xA1) (' . $len . ')'  , dechex($extension_data));
1368                                        break;
1369
1370                                default:
1371                                        // Unknown
1372                                        $result[] = 'UNKNOWN' .  $data;;
1373                                        //file_put_contents('/opt/lampp/htdocs/seguranca/temp/arquivo_desconhecido.txt',$data);
1374                                        $data = '';
1375                                        break;
1376                        }
1377        }
1378
1379        return (count($result) > 1) ? $result : array_pop($result);
1380
1381   }
1382   
1383   function openssl_to_timestamp ($in)
1384   {
1385        $year  = substr($in, 0, 4); /* NOTE: Yes, this returns a two digit year */
1386        $month = substr($in, 4, 2);
1387        $day   = substr($in, 6, 2);
1388        $hour  = substr($in, 8, 2);
1389        $min   = substr($in, 10, 2);
1390        $sec   = substr($in, 12, 2);
1391   
1392        return gmmktime($hour, $min, $sec, $month, $day, $year);
1393        }
1394
1395#============================================================================================
1396# Transforma o certificado do formato PEM para o formato DER ...
1397function pem2der($pem_data)
1398        {
1399                $begin = "CERTIFICATE-----";
1400                $end   = "-----END";
1401                $pem_data = substr($pem_data, strpos($pem_data, $begin)+strlen($begin));   
1402                $pem_data = substr($pem_data, 0, strpos($pem_data, $end));
1403                $der = base64_decode($pem_data);
1404                return $der;
1405        }
1406
1407
1408function recupera_dados_oid($certificado_digital_formato_der, $oid)
1409        {
1410                // Esta função assume que a oid esta inserida dentro de uma estrutura do tipo "sequencia" , como primeiro elemento da estrutura...
1411                $oid_hexa = OIDtoHex($oid);                                                        // converte oid de texto para hexadecimal ...
1412                $partes = explode($oid_hexa,$certificado_digital_formato_der);    // Faz o split pela oid...
1413                $ret = array();
1414                if(count($partes)>1)
1415                        {
1416                                for($i=1;$i<count($partes);$i++)
1417                                        {
1418                                                //O inicio da seq pode estar a 3 ou 2 digitos antes do inicio da oid .... depende do numero de bytes usados para  tamanho da seq.
1419                                                $xcv4 = substr($partes[$i-1],strlen($partes[$i-1])-4,4); // recupera da primeira parte os 4 ultimos digitos...
1420                                                $xcv3 = substr($partes[$i-1],strlen($partes[$i-1])-3,3); // recupera da primeira parte os 3 ultimos digitos...
1421                                                $xcv2 = substr($partes[$i-1],strlen($partes[$i-1])-2,2); // recupera da primeira parte os 2 ultimos digitos...
1422                                                if($xcv4[0] == chr(0x30))
1423                                                        {
1424                                                                $xcv = $xcv4;
1425                                                        }
1426                                                else
1427                                                        {
1428                                                                if($xcv3[0] == chr(0x30))
1429                                                                        {
1430                                                                                $xcv = $xcv3;
1431                                                                        }
1432                                                                else
1433                                                                        {
1434                                                                                $xcv = $xcv2;
1435                                                                        }
1436                                                        }
1437                                                $data = $xcv . $oid_hexa . $partes[$i];           // reconstroi a sequencia.....                               
1438                                                $len = ord($data[1]);
1439                                                $bytes = 0;
1440                                                get_length(&$len,&$bytes,$data);                  // obtem tamanho da parte de dados da oid.
1441                                                $oid_data = substr($data,2 + $bytes,$len);    // Obtem porcao de bytes pertencentes a oid.
1442                                                $ret[] =  Crl_parseASN($oid_data);                 // parse dos dados da oid.
1443                                        }
1444                        }
1445                return $ret;
1446        }
1447
1448
1449# Recupera dados da oid passada como parametro.....
1450function parse($oid,$valor)
1451        {
1452                //
1453                //  OID's PESSOA FISICA = 2.16.76.1.3.1 ,  2.16.76.1.3.6 ,  2.16.76.1.3.5 ,  2.16.76.1.4.n ... as 2.16.1.4.n não são obrigatórias e ão sao tratadas..
1454                //
1455                //  OID's PESSOA JURIDICA = 2.16.76.1.3.4 ,  2.16.76.1.3.2 , 2.16.76.1.3.3 , 2.16.76.1.3.7
1456                //
1457                //  OID's EQUIPAMENTO/APLICAÇÃO = 2.16.76.1.3.8 ,  2.16.76.1.3.3 , 2.16.76.1.3.2 , 2.16.76.1.3.4
1458                //     
1459                $oids = array('2.16.76.1.3.1' => array('1'=>array('NASCIMENTO',8),
1460                                                               '2'=>array('CPF',11),
1461                                                               '3'=>array('NIS',11),
1462                                                               '4'=>array('RG',15),
1463                                                               '5'=>array('ORGAOUF',6)),
1464                                     '2.16.76.1.3.2' => array('1'=>array('NOMERESPONSAVELCERTIFICADO',0)),
1465                                     '2.16.76.1.3.3' => array('1'=>array('CNPJ',14)),
1466                                     '2.16.76.1.3.4' => array('1'=>array('NASCIMENTO',8),
1467                                                               '2'=>array('CPF',11),
1468                                                               '3'=>array('NIS',11),
1469                                                               '4'=>array('RG',15),
1470                                                               '5'=>array('ORGAOUF',6)),       
1471                                     '2.16.76.1.3.5' => array('1'=>array('TITULO',12),
1472                                                              '2'=>array('ZONA',3),
1473                                                              '3'=>array('SECAO',4),
1474                                                              '4'=>array('TITULO_CIDADE_UF',0)),       
1475                                     '2.16.76.1.3.6' => array('1'=>array('CADINSS',12)),                                                             
1476                                     '2.16.76.1.3.7' => array('1'=>array('CEI',12)),                                                                   
1477                                     '2.16.76.1.3.8' => array('1'=>array('NOMEEMPRESARIAL',0)));                                     
1478                                     
1479                $resultado = array();
1480                $esta_oid = $oids[$oid];
1481                $p = 0;
1482                for($i=1;$i < count($esta_oid) + 1; $i++)
1483                        {
1484                                if($esta_oid[$i][1] == 0)
1485                                        {
1486                                                # se igual a zero, então esta apontando um ultimo elemento, iniciando em $p, até o fim dos dados
1487                                                $tamanho = strlen($valor) - $p;
1488                                        }
1489                                else
1490                                        {
1491                                                $tamanho = $esta_oid[$i][1];
1492                                        }
1493                                $resultado[$oid][$esta_oid[$i][0]] = substr($valor,$p,$tamanho);
1494                                // A linha logo abaixo he para manter compatibilidade com versoes anteriores... Sera desativada assim que possivel...
1495                                $resultado[$esta_oid[$i][0]] = substr($valor,$p,$tamanho);
1496                                $p = $p + $esta_oid[$i][1];
1497                        }
1498
1499                return $resultado;
1500        } 
1501
1502       
1503function subjectAltName($xx, $certificado_digital_formato_der)
1504        {
1505                $dados = array();
1506                $ret = recupera_dados_oid($certificado_digital_formato_der,'2.5.29.17');
1507                if(count($ret))
1508                {
1509                        if(substr($ret[0][1][0],0,12) == 'octet string')
1510                                {
1511                                        $ret = $ret[0][1][1][1];
1512                                }
1513                        else
1514                                {
1515                                        $ret = $ret[0][2][1][1];  // Se não iniciou por um octet string skipa para o próximo item na estrutura.
1516                                }
1517                        foreach($ret as $group)
1518                                {
1519                                        if(substr($group[0],0,17) == 'Context Especific')  // primeiro indice tem de ter o valor  'Context Especific' ...
1520                                                {
1521                                                        $oid = explode(':',$group[1][0][0][0]);   //  Pega o numero da oid.
1522                                                        $dados = array_merge(parse(trim($oid[1]), $group[1][0][1][1][0][1]),$dados); // Passa a oid e o seu valor para ser parseado....
1523                                                }
1524                                        if(substr($group[0],0,6) == 'string')
1525                                                {
1526                                                        if(strpos($group[1],'@'))                  //se he email tem de ter uma @.
1527                                                                {
1528                                                                        $aux_email = $group[1];
1529                                                                }
1530                                                }
1531                                }
1532                        // O  EMAIL foi localizado no loop de tratamento das OIDs.....
1533                        $dados['EMAIL'] = $aux_email;
1534                }
1535                return $dados;
1536        }
1537
1538       
1539function CRLDistributionPointsxx($xx, $certificado_digital_formato_der)
1540        {
1541                $AUX = recupera_dados_oid($certificado_digital_formato_der,'2.5.29.31');
1542                $i=1;
1543                if(substr($AUX[0][1][0],0,7) == 'boolean')
1544                        {
1545                                $i=2;
1546                        }
1547                $AUX1 = $AUX[0][$i][1][1][0];
1548                // Pode existir mais de uma crl, mas vamos considerar apenas a primeira.....
1549                return array('CRLDISTRIBUTIONPOINTS' => $AUX1[1][0][1][0][1][0][1]);           
1550        }       
1551
1552function CRLDistributionPoints($xx, $certificado_digital_formato_der)
1553        {
1554                $AUX = recupera_dados_oid($certificado_digital_formato_der,'2.5.29.31');
1555                $i=1;
1556                if(substr($AUX[0][1][0],0,7) == 'boolean')
1557                        {
1558                                $i=2;
1559                        }
1560                $ret = array();
1561                if($AUX[0][$i][1][1])
1562                        {
1563                                if(is_array($AUX[0][$i][1][1]))
1564                                        {
1565                                                //Pode existir mais de um local para obter a CRL.
1566                                                foreach($AUX[0][$i][1][1] as $crl)
1567                                                  {
1568                                                      if(substr($crl[1][0][1][0][1][0][1],0,4) == 'http')
1569                                                        {
1570                                                                $ret[] = $crl[1][0][1][0][1][0][1];
1571                                                        }
1572                                                  }
1573                                          }
1574                          }
1575                return array('CRLDISTRIBUTIONPOINTS' => $ret);
1576        }       
1577
1578
1579function SERIALNUMBER($cert_data,$KK)
1580        {
1581                $dados = array();
1582                if($cert_data[1][0][1][$KK][1])
1583                        {
1584                                $dados['SERIALNUMBER'] = $cert_data[1][0][1][$KK][1];
1585                        }
1586                return $dados;                 
1587        }
1588       
1589function SUBJECT($cert_data,$KK)
1590        {
1591                $dados = array();
1592                $dados['SUBJECT'] = array();
1593                foreach($cert_data[1][0][1][$KK][1] as $AUX2)
1594                        {
1595                                $dados['SUBJECT'][$AUX2[1][1][0][1]] = $AUX2[1][1][1][1];
1596                        }
1597                        $AUX = explode(':',$dados['SUBJECT']['CN']);
1598                $dados['NOME'] = $AUX[0];
1599                return $dados;                 
1600        }
1601               
1602function ISSUER($cert_data,$KK)         
1603        {
1604                $dados = array();       
1605                $AUX0 = '/';
1606                $dados['EMISSOR_CAMINHO_COMPLETO']  = array();
1607               
1608                foreach($cert_data[1][0][1][$KK][1] as $AUX2)
1609                        {
1610                                $dados['EMISSOR_CAMINHO_COMPLETO'][$AUX2[1][1][0][1]] = $AUX2[1][1][1][1] ;
1611                        }
1612                $dados['EMISSOR'] = $dados['EMISSOR_CAMINHO_COMPLETO']['CN'];
1613                return $dados; 
1614        }               
1615
1616
1617function BEFOREAFTER($cert_data,$KK)
1618        {
1619                $dados = array();
1620                $dados['INICIO_VALIDADE'] = data_hora($cert_data[1][0][1][$KK][1][0][1]);
1621                $dados['FIM_VALIDADE'] = data_hora($cert_data[1][0][1][$KK][1][1][1]);
1622                $agora = date('YmdHis');
1623                if(($agora < $dados['INICIO_VALIDADE']) || ($agora > $dados['FIM_VALIDADE']))
1624                        {
1625                                $dados['EXPIRADO'] = true;
1626                        }
1627                else
1628                        {
1629                                $dados['EXPIRADO'] = false;
1630                        }       
1631                return $dados;         
1632                }       
1633
1634
1635function AUTHORITYKEYIDENTIFIER($xx, $certificado_digital_formato_der)
1636        {
1637                $dados = array();
1638                if (isset($certificado_digital_formato_der))
1639                        {
1640                                $caid = recupera_dados_oid($certificado_digital_formato_der,'2.5.29.35');
1641                                $i=1;
1642                                if(substr($caid[0][1][0],0,7) == 'boolean')
1643                                        {
1644                                                $i=2;
1645                                        }
1646                                $dados['AUTHORITYKEYIDENTIFIER'] = $caid[0][$i][1][1][0][1];
1647                        }
1648                else
1649                        {
1650                                // Se nao existir um valor, assume certificado auto assinado .....
1651                                $dados['AUTHORITYKEYIDENTIFIER'] = "auto-assinado";
1652                        }
1653                return $dados;                 
1654        }
1655       
1656function KEYUSAGE($xx, $certificado_digital_formato_der)
1657        {
1658                $KeyUsage= array( 0x80 => 'digitalSignature',
1659                              0x40 => 'nonRepudiation',
1660                              0x20 => 'keyEncipherment',
1661                              0x10 => 'dataEncipherment',
1662                              0x08 => 'keyAgreement',
1663                              0x04 => 'keyCertSign',
1664                              0x02 => 'cRLSign');
1665
1666                $dados = array();
1667                if (isset($certificado_digital_formato_der))
1668                        {
1669                                $AUX = recupera_dados_oid($certificado_digital_formato_der,'2.5.29.15');  // busca oid do keyusage
1670                                $AUX = explode(':',$AUX[0][2][1][1]);
1671                                if(count($AUX) == 3)
1672                                        {
1673                                                foreach($KeyUsage as $chave => $valor)
1674                                                        {
1675                                                                if($AUX[2] & $chave)
1676                                                                        {
1677                                                                                $dados['KEYUSAGE'][$valor] = TRUE;
1678                                                                        }
1679                                                        }
1680                                        }
1681                        }       
1682                return $dados;                 
1683        }
1684
1685function EXTKEYUSAGE($xx, $certificado_digital_formato_der)
1686        {
1687                $dados = array();
1688                if (isset($certificado_digital_formato_der))
1689                        {
1690                                $AUX = recupera_dados_oid($certificado_digital_formato_der,'2.5.29.37');  // busca oid do extkeyusage
1691                                $AUX1 = $AUX[0][count($AUX[0])-1];
1692                                if(count($AUX1) > 0)
1693                                {
1694                                foreach($AUX1[1][1] as $itens)
1695                                        {
1696                                                $AUX2 = explode(':',$itens[0]);
1697                                                $dados['EXTKEYUSAGE'][trim($itens[1])] =  trim($AUX2[1]);
1698                                        }
1699                                }
1700                        }
1701                return $dados;                 
1702        }
1703       
1704function BASICCONSTRAINTS($xx, $certificado_digital_formato_der)
1705        {
1706                $dados = array();
1707                if (isset($certificado_digital_formato_der))
1708                        {
1709                                $AUX = recupera_dados_oid($certificado_digital_formato_der,'2.5.29.19');  // busca oid do BasicConstraints
1710                                if(count($AUX) > 0)
1711                                        {
1712                                                $dados['CA'] = $AUX[0][count($AUX[0])-1][1][1][0][1];
1713                                        }
1714                        }
1715                return $dados;                 
1716        }
1717       
1718function recupera_dados_do_ceritificado_digital($certificado_digital_formato_pem)
1719        {
1720                $cert_der =  pem2der($certificado_digital_formato_pem);
1721               
1722                $funcoes = array(SERIALNUMBER => 1,
1723                                        ISSUER => 3,
1724                                        BEFOREAFTER => 4,
1725                                        SUBJECT => 5,
1726                                        AUTHORITYKEYIDENTIFIER => $cert_der,
1727                                        KEYUSAGE => $cert_der,
1728                                        EXTKEYUSAGE => $cert_der,
1729                                        BASICCONSTRAINTS => $cert_der,
1730                                        CRLDistributionPoints =>  $cert_der,
1731                                        subjectAltName => $cert_der);
1732                           
1733                $dados=array();
1734               
1735                $cert_data = Crl_parseASN( $cert_der);
1736               
1737                foreach($funcoes as $funcao => $parametro)
1738                        {
1739                                $dados= array_merge($dados,$funcao($cert_data,$parametro));
1740                        }
1741
1742                if(!$dados['EMAIL'])
1743                        {
1744                                $AUX = explode('emailAddress=',$dados['SUBJECT']);
1745                                if(count($AUX) > 1)
1746                                        {
1747                                                $dados['EMAIL'] = $AUX[1];
1748                                        }
1749                        }
1750                return $dados;         
1751        }
1752
1753#============================================================================================
1754
1755?>
Note: See TracBrowser for help on using the repository browser.