Program: 52528
Project: 52528
Buggy source:
/** 
 * we generate a certificate signed by our CA's intermediate certficate
 */
public static Certificate createCert(PublicKey pubKey,PrivateKey caPrivKey,PublicKey caPubKey) throws Exception {
  Hashtable sAttrs=new Hashtable();
  Vector sOrder=new Vector();
  sAttrs.put(X509Principal.C,"String_Node_Str");
  sAttrs.put(X509Principal.O,"String_Node_Str");
  sAttrs.put(X509Principal.OU,"String_Node_Str");
  sAttrs.put(X509Principal.EmailAddress,"String_Node_Str");
  sOrder.addElement(X509Principal.C);
  sOrder.addElement(X509Principal.O);
  sOrder.addElement(X509Principal.OU);
  sOrder.addElement(X509Principal.EmailAddress);
  Hashtable attrs=new Hashtable();
  Vector order=new Vector();
  attrs.put(X509Principal.C,"String_Node_Str");
  attrs.put(X509Principal.O,"String_Node_Str");
  attrs.put(X509Principal.L,"String_Node_Str");
  attrs.put(X509Principal.CN,"String_Node_Str");
  attrs.put(X509Principal.EmailAddress,"String_Node_Str");
  order.addElement(X509Principal.C);
  order.addElement(X509Principal.O);
  order.addElement(X509Principal.L);
  order.addElement(X509Principal.CN);
  order.addElement(X509Principal.EmailAddress);
  v3CertGen.reset();
  v3CertGen.setSerialNumber(BigInteger.valueOf(3));
  v3CertGen.setIssuerDN(new X509Principal(sOrder,sAttrs));
  v3CertGen.setNotBefore(new Date(System.currentTimeMillis() - 1000L * 60 * 60* 24* 30));
  v3CertGen.setNotAfter(new Date(System.currentTimeMillis() + (1000L * 60 * 60* 24* 30)));
  v3CertGen.setSubjectDN(new X509Principal(order,attrs));
  v3CertGen.setPublicKey(pubKey);
  v3CertGen.setSignatureAlgorithm("String_Node_Str");
  v3CertGen.addExtension(X509Extensions.SubjectKeyIdentifier,false,new SubjectKeyIdentifierStructure(pubKey));
  v3CertGen.addExtension(X509Extensions.AuthorityKeyIdentifier,false,new AuthorityKeyIdentifierStructure(caPubKey));
  X509Certificate cert=v3CertGen.generate(caPrivKey);
  cert.checkValidity(new Date());
  cert.verify(caPubKey);
  PKCS12BagAttributeCarrier bagAttr=(PKCS12BagAttributeCarrier)cert;
  bagAttr.setBagAttribute(PKCSObjectIdentifiers.pkcs_9_at_friendlyName,new DERBMPString("String_Node_Str"));
  bagAttr.setBagAttribute(PKCSObjectIdentifiers.pkcs_9_at_localKeyId,new SubjectKeyIdentifierStructure(pubKey));
  return cert;
}

Fixed version (ground truth):
/** 
 * we generate a certificate signed by our CA's intermediate certficate
 */
public static Certificate createCert(PublicKey pubKey,PrivateKey caPrivKey,PublicKey caPubKey) throws Exception {
  Hashtable sAttrs=new Hashtable();
  Vector sOrder=new Vector();
  sAttrs.put(X509Principal.C,"String_Node_Str");
  sAttrs.put(X509Principal.O,"String_Node_Str");
  sAttrs.put(X509Principal.OU,"String_Node_Str");
  sAttrs.put(X509Principal.EmailAddress,"String_Node_Str");
  sOrder.addElement(X509Principal.C);
  sOrder.addElement(X509Principal.O);
  sOrder.addElement(X509Principal.OU);
  sOrder.addElement(X509Principal.EmailAddress);
  Hashtable attrs=new Hashtable();
  Vector order=new Vector();
  attrs.put(X509Principal.C,"String_Node_Str");
  attrs.put(X509Principal.O,"String_Node_Str");
  attrs.put(X509Principal.L,"String_Node_Str");
  attrs.put(X509Principal.CN,"String_Node_Str");
  attrs.put(X509Principal.EmailAddress,"String_Node_Str");
  order.addElement(X509Principal.C);
  order.addElement(X509Principal.O);
  order.addElement(X509Principal.L);
  order.addElement(X509Principal.CN);
  order.addElement(X509Principal.EmailAddress);
  v3CertGen.reset();
  v3CertGen.setSerialNumber(BigInteger.valueOf(3));
  v3CertGen.setIssuerDN(new X509Principal(sOrder,sAttrs));
  v3CertGen.setNotBefore(new Date(System.currentTimeMillis() - 1000L * 60 * 60* 24* 30));
  v3CertGen.setNotAfter(new Date(System.currentTimeMillis() + (1000L * 60 * 60* 24* 30)));
  v3CertGen.setSubjectDN(new X509Principal(order,attrs));
  v3CertGen.setPublicKey(pubKey);
  v3CertGen.setSignatureAlgorithm("String_Node_Str");
  v3CertGen.addExtension(X509Extensions.SubjectKeyIdentifier,false,new SubjectKeyIdentifierStructure(getDigest(SubjectPublicKeyInfo.getInstance(pubKey.getEncoded()))));
  v3CertGen.addExtension(X509Extensions.AuthorityKeyIdentifier,false,new AuthorityKeyIdentifierStructure(caPubKey));
  X509Certificate cert=v3CertGen.generate(caPrivKey);
  cert.checkValidity(new Date());
  cert.verify(caPubKey);
  PKCS12BagAttributeCarrier bagAttr=(PKCS12BagAttributeCarrier)cert;
  bagAttr.setBagAttribute(PKCSObjectIdentifiers.pkcs_9_at_friendlyName,new DERBMPString("String_Node_Str"));
  bagAttr.setBagAttribute(PKCSObjectIdentifiers.pkcs_9_at_localKeyId,new SubjectKeyIdentifierStructure(getDigest(SubjectPublicKeyInfo.getInstance(pubKey.getEncoded()))));
  return cert;
}