Firefox bad_certificate NFS-e

0 respostas
tiagokihara

Boa tarde.

Estou com um problema na minha comunicação com o web service da Nota Fiscal Eletrônica de Serviços.

Eu criei uma applet que lê as informações do token e faz o envio do arquivo xml, até ai tudo bem.

O problema é que no IE funciona normalmente, mas no Firefox me retorna um HTTP transport error: javax.net.ssl.SSLHandshakeException: Received fatal alert: bad_certificate.

Analisando o debug do handshake, no IE eu tenho isso…

.
.
.
<CN=SERASA Autoridade Certificadora v1, OU=CSPB-4, O=ICP-Brasil, C=BR>
<CN=AC PETROBRAS G2, OU=PETROLEO BRASILEIRO S A PETROBRAS, O=ICP-Brasil, C=BR>
*** ServerHelloDone
***
found key for : MSCryptoRSAPrivateKey [HCRYPTPROV=XXXXXXX, HCRYPTKEY=XXXXXXX, key length=1024bits]
chain [0] = [
[
  Version: V3
  Subject: CN=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, OU=Autenticado por Certisign Certificadora Digital, OU=RFB e-CNPJ A3, OU=Secretaria da Receita Federal do Brasil - RFB, O=ICP-Brasil, L=XXXXXXXXX, ST=XX, C=BR
  Signature Algorithm: SHA1withRSA, OID = XXXXXXXXXXXXXXXXXXX
.
.
.

no firefox…

.
.
.
<CN=SERASA Autoridade Certificadora v1, OU=CSPB-4, O=ICP-Brasil, C=BR>
<CN=AC PETROBRAS G2, OU=PETROLEO BRASILEIRO S A PETROBRAS, O=ICP-Brasil, C=BR>
*** ServerHelloDone
*** Certificate chain
***
*** ClientKeyExchange, RSA PreMasterSecret, TLSv1
thread applet-faturamento.applet.NfseApplet-1, WRITE: TLSv1 Handshake, length = 141
SESSION KEYGEN:
PreMaster Secret:
.
.
.
thread applet-faturamento.applet.NfseApplet-1, WRITE: TLSv1 Handshake, length = 32
thread applet-faturamento.applet.NfseApplet-1, READ: TLSv1 Alert, length = 2
thread applet-faturamento.applet.NfseApplet-1, RECV TLSv1 ALERT:  fatal, bad_certificate
thread applet-faturamento.applet.NfseApplet-1, called closeSocket()
thread applet-faturamento.applet.NfseApplet-1, handling exception: javax.net.ssl.SSLHandshakeException: Received fatal alert: bad_certificate

Estou usando um token A3 e defini as configurações do sistema com…

String configName = "C:\\token.cfg";
        
        Provider provider = new sun.security.pkcs11.SunPKCS11(configName);
        Security.addProvider(provider);
        
        System.setProperty("javax.net.debug", "ssl");
        
        System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true");  
        
        System.setProperty("javax.net.ssl.keyStoreType", "PKCS11");
        System.setProperty("javax.net.ssl.keyStoreProvider", provider.getName());
        System.setProperty("javax.net.ssl.keyStore", "NONE");
        System.setProperty("javax.net.ssl.keyStorePassword", senha.toString());
        
        System.setProperty("javax.net.ssl.trustStoreType", "JKS");
        System.setProperty("javax.net.ssl.trustStore", "C:\\keystore.jks");

e no token.cfg

name="e-CNPJ Certisign"
library=C:/Windows/System32/aetpkss1.dll

Alguém já passou por isso ou tem alguma ideia do que possa estar acontecendo?

Obrigado

Criado 6 de junho de 2012
Respostas 0
Participantes 1