public List<BurpCertificate> cloneCertificateChain(List<BurpCertificate> certificateChain){
  List<BurpCertificate> certificates=new LinkedList<>();
  Collections.reverse(certificateChain);
  BurpCertificate currentCertificate=null;
  BurpCertificate previousCertificate=null;
  for (  BurpCertificate c : certificateChain) {
    if (previousCertificate == null) {
      currentCertificate=cloneCertificate(c,new BurpCertificateBuilder(c.getSubject()));
    }
 else {
      currentCertificate=cloneAndSignCertificate(c,new BurpCertificateBuilder(c.getSubject()),previousCertificate);
    }
    burpCertificateStore.removeCertificate(currentCertificate);
    certificates.add(currentCertificate);
    previousCertificate=currentCertificate;
  }
  Collections.reverse(certificates);
  burpCertificateStore.addCertificateChain(certificates);
  setStatus("Certificate chain cloned");
  setCertificateTree();
  return certificates;
}

public List < BurpCertificate > cloneCertificateChain ( List < BurpCertificate > certificateChain ) { List < BurpCertificate > certificates = new LinkedList < > ( ) ; Collections . reverse ( certificateChain ) ; BurpCertificate currentCertificate = null ; BurpCertificate previousCertificate = null ; for ( BurpCertificate c : certificateChain ) { if ( previousCertificate == null ) { currentCertificate = cloneCertificate ( c , new BurpCertificateBuilder ( c . getSubject ( ) ) ) ; } else { currentCertificate = cloneAndSignCertificate ( c , new BurpCertificateBuilder ( c . getSubject ( ) ) , previousCertificate ) ; } burpCertificateStore . removeCertificate ( currentCertificate ) ; certificates . add ( currentCertificate ) ; previousCertificate = currentCertificate ; } Collections . reverse ( certificates ) ; burpCertificateStore . addCertificateChain ( certificates ) ; setStatus ( "Certificate chain cloned" ) ; setCertificateTree ( ) ; return certificates ; }
clone whole certificate chain
