source: trunk/security/classes/funcoes_auxiliares.php @ 7673

Revision 7673, 75.1 KB checked in by douglasz, 11 years ago (diff)

Ticket #3236 - Correcoes para Performance: Function Within Loop Declaration.

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