Program: 52529
Project: 52529
Buggy source:
public static void main(String[] args) throws Exception {
  Security.addProvider(new BouncyCastleProvider());
  RSAPublicKeySpec pubKeySpec=new RSAPublicKeySpec(new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16));
  RSAPrivateCrtKeySpec privKeySpec=new RSAPrivateCrtKeySpec(new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16));
  RSAPublicKeySpec intPubKeySpec=new RSAPublicKeySpec(new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16));
  RSAPrivateCrtKeySpec intPrivKeySpec=new RSAPrivateCrtKeySpec(new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16));
  RSAPublicKeySpec caPubKeySpec=new RSAPublicKeySpec(new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16));
  RSAPrivateCrtKeySpec caPrivKeySpec=new RSAPrivateCrtKeySpec(new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16));
  KeyFactory fact=KeyFactory.getInstance("String_Node_Str","String_Node_Str");
  PrivateKey caPrivKey=fact.generatePrivate(caPrivKeySpec);
  PublicKey caPubKey=fact.generatePublic(caPubKeySpec);
  PrivateKey intPrivKey=fact.generatePrivate(intPrivKeySpec);
  PublicKey intPubKey=fact.generatePublic(intPubKeySpec);
  PrivateKey privKey=fact.generatePrivate(privKeySpec);
  PublicKey pubKey=fact.generatePublic(pubKeySpec);
  Certificate[] chain=new Certificate[3];
  chain[2]=createMasterCert(caPubKey,caPrivKey);
  chain[1]=createIntermediateCert(intPubKey,caPrivKey,(X509Certificate)chain[2]);
  chain[0]=createCert(pubKey,intPrivKey,intPubKey);
  PKCS12BagAttributeCarrier bagAttr=(PKCS12BagAttributeCarrier)privKey;
  bagAttr.setBagAttribute(PKCSObjectIdentifiers.pkcs_9_at_friendlyName,new DERBMPString("String_Node_Str"));
  bagAttr.setBagAttribute(PKCSObjectIdentifiers.pkcs_9_at_localKeyId,new SubjectKeyIdentifierStructure(pubKey));
  KeyStore store=KeyStore.getInstance("String_Node_Str","String_Node_Str");
  store.load(null,null);
  store.setKeyEntry("String_Node_Str",privKey,null,chain);
  FileOutputStream fOut=new FileOutputStream("String_Node_Str");
  store.store(fOut,passwd);
  fOut.close();
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  Security.addProvider(new BouncyCastleProvider());
  RSAPublicKeySpec pubKeySpec=new RSAPublicKeySpec(new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16));
  RSAPrivateCrtKeySpec privKeySpec=new RSAPrivateCrtKeySpec(new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16));
  RSAPublicKeySpec intPubKeySpec=new RSAPublicKeySpec(new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16));
  RSAPrivateCrtKeySpec intPrivKeySpec=new RSAPrivateCrtKeySpec(new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16));
  RSAPublicKeySpec caPubKeySpec=new RSAPublicKeySpec(new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16));
  RSAPrivateCrtKeySpec caPrivKeySpec=new RSAPrivateCrtKeySpec(new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16),new BigInteger("String_Node_Str",16));
  KeyFactory fact=KeyFactory.getInstance("String_Node_Str","String_Node_Str");
  PrivateKey caPrivKey=fact.generatePrivate(caPrivKeySpec);
  PublicKey caPubKey=fact.generatePublic(caPubKeySpec);
  PrivateKey intPrivKey=fact.generatePrivate(intPrivKeySpec);
  PublicKey intPubKey=fact.generatePublic(intPubKeySpec);
  PrivateKey privKey=fact.generatePrivate(privKeySpec);
  PublicKey pubKey=fact.generatePublic(pubKeySpec);
  Certificate[] chain=new Certificate[3];
  chain[2]=createMasterCert(caPubKey,caPrivKey);
  chain[1]=createIntermediateCert(intPubKey,caPrivKey,(X509Certificate)chain[2]);
  chain[0]=createCert(pubKey,intPrivKey,intPubKey);
  PKCS12BagAttributeCarrier bagAttr=(PKCS12BagAttributeCarrier)privKey;
  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()))));
  KeyStore store=KeyStore.getInstance("String_Node_Str","String_Node_Str");
  store.load(null,null);
  store.setKeyEntry("String_Node_Str",privKey,null,chain);
  FileOutputStream fOut=new FileOutputStream("String_Node_Str");
  store.store(fOut,passwd);
  fOut.close();
}