}
else if (hashAlgorithm.equals("SHA1")) {
digestAlgorithm = ID_SHA1;
}
else {
throw new NoSuchAlgorithmException("Unknown Hash Algorithm "+hashAlgorithm);
}
version = signerversion = 1;
certs = new ArrayList();
crls = new ArrayList();
digestalgos = new HashSet();
digestalgos.add(digestAlgorithm);
//
// Copy in the certificates and crls used to sign the private key.
//
signCert = (X509Certificate)certChain[0];
for (int i = 0;i < certChain.length;i++) {
certs.add(certChain[i]);
}
if (crlList != null) {
for (int i = 0;i < crlList.length;i++) {
crls.add(crlList[i]);
}
}
if (privKey != null) {
//
// Now we have private key, find out what the digestEncryptionAlgorithm is.
//
digestEncryptionAlgorithm = privKey.getAlgorithm();
if (digestEncryptionAlgorithm.equals("RSA")) {
digestEncryptionAlgorithm = ID_RSA;
}
else if (digestEncryptionAlgorithm.equals("DSA")) {
digestEncryptionAlgorithm = ID_DSA;
}
else {
throw new NoSuchAlgorithmException("Unknown Key Algorithm "+digestEncryptionAlgorithm);
}
}
if (hasRSAdata) {
RSAdata = new byte[0];
if (provider == null || provider.startsWith("SunPKCS11"))