log.finest("\n" + Util.dumpString(encryptedDigest, "--- signedSFBytes "));
if (Configuration.DEBUG) log.fine("\n" + Util.dumpString(encryptedDigest, "--- signedSFBytes "));
  private boolean verifySF(String sigFileName) throws CRLException,      CertificateException, ZipException, IOException  {    log.entering(this.getClass().getName(), "verifySF"); //$NON-NLS-1$    log.finest("About to verify signature of " + sigFileName + "..."); //$NON-NLS-1$ //$NON-NLS-2$    // 1. find the corresponding .DSA file for this .SF file    JarEntry dsaEntry = jarFile.getJarEntry(JarUtils.META_INF + sigFileName                                            + JarUtils.DSA_SUFFIX);    if (dsaEntry == null)      throw new SecurityException(Messages.getFormattedString("JarVerifier.13", //$NON-NLS-1$                                                              sigFileName));    // 2. read the .DSA file contents as a PKCS7 SignedData    InputStream in = jarFile.getInputStream(dsaEntry);    PKCS7SignedData pkcs7SignedData = new PKCS7SignedData(in);    // 4. get the encrypted digest octet string from the first SignerInfo    //    this octet string is the digital signature of the .SF file contents    Set signerInfos = pkcs7SignedData.getSignerInfos();    if (signerInfos == null || signerInfos.isEmpty())      throw new SecurityException(Messages.getString("JarVerifier.14")); //$NON-NLS-1$    SignerInfo signerInfo = (SignerInfo) signerInfos.iterator().next();    byte[] encryptedDigest = signerInfo.getEncryptedDigest();    if (encryptedDigest == null)      throw new SecurityException(Messages.getString("JarVerifier.16")); //$NON-NLS-1$    log.finest("\n" + Util.dumpString(encryptedDigest, "--- signedSFBytes ")); //$NON-NLS-1$ //$NON-NLS-2$    // 5. get the signer public key    Certificate cert = pkcs7SignedData.getCertificates()[0];    PublicKey verifierKey = cert.getPublicKey();    log.finest("--- verifier public key = " + verifierKey); //$NON-NLS-1$    // 6. verify the signature file signature    OID digestEncryptionAlgorithmOID = signerInfo.getDigestEncryptionAlgorithmId();    ISignature signatureAlgorithm;    ISignatureCodec signatureCodec;    if (digestEncryptionAlgorithmOID.equals(Main.DSA_SIGNATURE_OID))      {        signatureAlgorithm = new DSSSignature();        signatureCodec = new DSSSignatureX509Codec();      }    else      {        signatureAlgorithm = new RSAPKCS1V1_5Signature(Registry.MD5_HASH);        signatureCodec = new RSAPKCS1V1_5SignatureX509Codec();      }    Map signatureAttributes = new HashMap();    signatureAttributes.put(ISignature.VERIFIER_KEY, verifierKey);    signatureAlgorithm.setupVerify(signatureAttributes);    Object herSignature = signatureCodec.decodeSignature(encryptedDigest);    // 7. verify the signature file contents    JarEntry sfEntry = jarFile.getJarEntry(JarUtils.META_INF + sigFileName                                           + JarUtils.SF_SUFFIX);    in = jarFile.getInputStream(sfEntry);    byte[] buffer = new byte[2048];    int n;    while ((n = in.read(buffer)) != -1)      if (n > 0)        signatureAlgorithm.update(buffer, 0, n);    boolean result = signatureAlgorithm.verify(herSignature);    log.finer("Signature block [" + sigFileName + "] is " //$NON-NLS-1$ //$NON-NLS-2$              + (result ? "" : "NOT ") + "OK"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$    log.exiting(this.getClass().getName(), "verifySF", Boolean.valueOf(result)); //$NON-NLS-1$    return result;  }