}
}
byte sh[] = sgn.getAuthenticatedAttributeBytes(hash, cal, ocsp);
sgn.update(sh, 0, sh.length);
TSAClientBouncyCastle tsc = null;
if (options.isTimestampX() && !StringUtils.isEmpty(options.getTsaUrl())) {
options.log("console.creatingTsaClient");
tsc = new TSAClientBouncyCastle(options.getTsaUrl(), StringUtils.emptyNull(options.getTsaUser()),
StringUtils.emptyNull(options.getTsaPasswd()));
tsc.setProxy(tmpProxy);
final String policyOid = options.getTsaPolicy();
if (StringUtils.hasLength(policyOid)) {
options.log("console.settingTsaPolicy", policyOid);
tsc.setPolicy(policyOid);
}
}
byte[] encodedSig = sgn.getEncodedPKCS7(hash, cal, tsc, ocsp);
if (contentEstimated + 2 < encodedSig.length) {