if (name.endsWith(PKCS7_DSA_SUFFIX) || name.endsWith(PKCS7_RSA_SUFFIX))
{
if (DEBUG)
debug("reading PKCS7 info from " + name + ", alias=" + alias);
PKCS7SignedData sig = null;
try
{
sig = new PKCS7SignedData(super.getInputStream(ze));
}
catch (CertificateException ce)
{
IOException ioe = new IOException("certificate parsing error");
ioe.initCause(ce);
throw ioe;
}
catch (CRLException crle)
{
IOException ioe = new IOException("CRL parsing error");
ioe.initCause(crle);
throw ioe;
}
if (name.endsWith(PKCS7_DSA_SUFFIX))
pkcs7Dsa.put(alias, sig);
else if (name.endsWith(PKCS7_RSA_SUFFIX))
pkcs7Rsa.put(alias, sig);
}
else if (name.endsWith(SF_SUFFIX))
{
if (DEBUG)
debug("reading signature file for " + alias + ": " + name);
Manifest sf = new Manifest(super.getInputStream(ze));
sigFiles.put(alias, sf);
if (DEBUG)
debug("result: " + sf);
}
}
}
// Phase 2: verify the signatures on any signature files.
Set validCerts = new HashSet();
Map entryCerts = new HashMap();
for (Iterator it = sigFiles.entrySet().iterator(); it.hasNext(); )
{
int valid = 0;
Map.Entry e = (Map.Entry) it.next();
String alias = (String) e.getKey();
PKCS7SignedData sig = (PKCS7SignedData) pkcs7Dsa.get(alias);
if (sig != null)
{
Certificate[] certs = sig.getCertificates();
Set signerInfos = sig.getSignerInfos();
for (Iterator it2 = signerInfos.iterator(); it2.hasNext(); )
verify(certs, (SignerInfo) it2.next(), alias, validCerts);
}
sig = (PKCS7SignedData) pkcs7Rsa.get(alias);
if (sig != null)
{
Certificate[] certs = sig.getCertificates();
Set signerInfos = sig.getSignerInfos();
for (Iterator it2 = signerInfos.iterator(); it2.hasNext(); )
verify(certs, (SignerInfo) it2.next(), alias, validCerts);
}
// It isn't a signature for anything. Punt it.