public void setSignInfo(PrivateKey privKey, Certificate[] certChain, CRL[] crlList) {
        try {
            pkcs = new PdfPKCS7(privKey, certChain, crlList, hashAlgorithm, provider, PdfName.ADBE_PKCS7_SHA1.equals(get(PdfName.SUBFILTER)));
            pkcs.setExternalDigest(externalDigest, externalRSAdata, digestEncryptionAlgorithm);
            if (PdfName.ADBE_X509_RSA_SHA1.equals(get(PdfName.SUBFILTER))) {
                ByteArrayOutputStream bout = new ByteArrayOutputStream();
                for (int k = 0; k < certChain.length; ++k) {
                    bout.write(certChain[k].getEncoded());
                }
                bout.close();
                setCert(bout.toByteArray());
                setContents(pkcs.getEncodedPKCS1());
            }
            else
                setContents(pkcs.getEncodedPKCS7());
            name = PdfPKCS7.getSubjectFields(pkcs.getSigningCertificate()).getField("CN");
            if (name != null)
                put(PdfName.NAME, new PdfString(name, PdfObject.TEXT_UNICODE));
            pkcs = new PdfPKCS7(privKey, certChain, crlList, hashAlgorithm, provider, PdfName.ADBE_PKCS7_SHA1.equals(get(PdfName.SUBFILTER)));
            pkcs.setExternalDigest(externalDigest, externalRSAdata, digestEncryptionAlgorithm);
        }
        catch (Exception e) {
            throw new ExceptionConverter(e);
        }
    }
public void setSignInfo ( PrivateKey privKey , Certificate [ ] certChain , CRL [ ] crlList ) { try { pkcs = new PdfPKCS7 ( privKey , certChain , crlList , hashAlgorithm , provider , PdfName . ADBE_PKCS7_SHA1 . equals ( get ( PdfName . SUBFILTER ) ) ) ; pkcs . setExternalDigest ( externalDigest , externalRSAdata , digestEncryptionAlgorithm ) ; if ( PdfName . ADBE_X509_RSA_SHA1 . equals ( get ( PdfName . SUBFILTER ) ) ) { ByteArrayOutputStream bout = new ByteArrayOutputStream ( ) ; for ( int k = 0 ; k < certChain . length ; ++ k ) { bout . write ( certChain [ k ] . getEncoded ( ) ) ; } bout . close ( ) ; setCert ( bout . toByteArray ( ) ) ; setContents ( pkcs . getEncodedPKCS1 ( ) ) ; } else setContents ( pkcs . getEncodedPKCS7 ( ) ) ; name = PdfPKCS7 . getSubjectFields ( pkcs . getSigningCertificate ( ) ) . getField ( "CN" ) ; if ( name != null ) put ( PdfName . NAME , new PdfString ( name , PdfObject . TEXT_UNICODE ) ) ; pkcs = new PdfPKCS7 ( privKey , certChain , crlList , hashAlgorithm , provider , PdfName . ADBE_PKCS7_SHA1 . equals ( get ( PdfName . SUBFILTER ) ) ) ; pkcs . setExternalDigest ( externalDigest , externalRSAdata , digestEncryptionAlgorithm ) ; } catch ( Exception e ) { throw new ExceptionConverter ( e ) ; } }
Sets the crypto information to sign.
@param privKey the private key
@param certChain the certificate chain
@param crlList the certificate revocation list. It can be <CODE>null</CODE>