Thanks a lot for your reply, i thought the problem was either when i
generated the hash or when i sign it. The problem with the CcMethods
documentation is that .... i made that class :P

this is the code for the signing method:


          // Signs given hash
          public static byte[] sign(byte[] hash){
                try {
                        KeyStore ks = builder.getKeyStore();
                        Key key = ks.getKey(aliasCertifLabel, null);
                        CK_MECHANISM mechanism = new CK_MECHANISM();
                        mechanism.mechanism = PKCS11Constants.CKM_RSA_PKCS;
                        mechanism.pParameter = null;
                        
                        Signature sig = 
Signature.getInstance("SHA1withRSA",ks.getProvider());
                        sig.initSign((PrivateKey)key) ;
                        sig.update(hash);
                        return sig.sign();
                  } catch (Exception e) {
                        e.printStackTrace();
                  }
                  return null;
          }

this seemed quite simple and since i get asked for the digital signature pin
and i see the certificate inside the pdf document, i assumed everything was
working well.

Do you see anything wrong with this?

Regards,
Pedro
-- 
View this message in context: 
http://itext-general.2136553.n4.nabble.com/Another-invalid-signature-thread-tp3003710p3005734.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to