Changeset 5276 for branches


Ignore:
Timestamp:
12/20/11 15:49:00 (8 years ago)
Author:
rafaelraymundo
Message:

Ticket #2395 - Assinatura/cifragem digital de emails - Suporte a SHA512.

Location:
branches/2.3/security
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.3/security/ExpressoCert/src/br/gov/serpro/cert/DigitalCertificate.java

    r5179 r5276  
    539539        //SMIMESignedGenerator gen = new SMIMESignedGenerator(); 
    540540 
    541         gen.addSigner(keypair.getPrivate(), (X509Certificate) certificate, SMIMESignedGenerator.DIGEST_SHA1, new AttributeTable(signedAttrs), null); 
     541        // TODO:  Verificar se este código é suficiente para cumprir a norma. 
     542        if (this.setup.getParameter("debug").equalsIgnoreCase("true")) { 
     543            Provider.Service sha512 = this.keyStore.getProvider().getService("MessageDigest", "SHA-512"); 
     544            Provider.Service sha256 = this.keyStore.getProvider().getService("MessageDigest", "SHA-256"); 
     545 
     546            if (sha512 != null){ 
     547                System.out.println("sha512: " + sha512.getType() + " : " + sha512.getAlgorithm()); 
     548            } else { 
     549                    System.out.println("sha512: não suportado!"); 
     550            } 
     551 
     552            if (sha256 != null){ 
     553                    System.out.println("sha256: " + sha256.getType() + " : " + sha256.getAlgorithm()); 
     554            } else { 
     555                    System.out.println("sha256: não suportado!"); 
     556            } 
     557        } 
     558 
     559        // TODO: Verificar problema com MessageDigest SHA-512. 
     560//        if (this.keyStore.getProvider().getService("MessageDigest", "SHA-512") != null){ 
     561//            gen.addSigner(keypair.getPrivate(), (X509Certificate) certificate, SMIMESignedGenerator.DIGEST_SHA512, new AttributeTable(signedAttrs), null); 
     562//        } 
     563//        else 
     564        if (this.keyStore.getProvider().getService("MessageDigest", "SHA-256") != null){ 
     565            gen.addSigner(keypair.getPrivate(), (X509Certificate) certificate, SMIMESignedGenerator.DIGEST_SHA256, new AttributeTable(signedAttrs), null); 
     566        } 
     567        else { 
     568            gen.addSigner(keypair.getPrivate(), (X509Certificate) certificate, SMIMESignedGenerator.DIGEST_SHA1, new AttributeTable(signedAttrs), null); 
     569        } 
    542570 
    543571        gen.addCertificatesAndCRLs(certsAndcrls); 
Note: See TracChangeset for help on using the changeset viewer.