sig.prependBSTElementToHeader(secHeader);
List<Reference> referenceList = sig.addReferencesToSign(sigParts, secHeader);
if (bottomUpElement == null) {
sig.computeSignature(referenceList, false, null);
} else {
sig.computeSignature(referenceList, true, bottomUpElement);
}
bottomUpElement = sig.getSignatureElement();
mainSigId = sig.getId();