}
_md = MessageDigest.getInstance(algo);
} catch (NoSuchAlgorithmException nsae) {
logger.log(Level.SEVERE,LogStringsMessages.WSS_1760_DIGEST_INIT_ERROR(),nsae);
throw new XMLSignatureException(nsae);
}
}
_md.reset();
DigesterOutputStream dos;
//Boolean cache = (Boolean)context.getProperty("javax.xml.crypto.dsig.cacheReference");
dos = new DigesterOutputStream(_md);
OutputStream os = new UnsyncBufferedOutputStream(dos);
Data data = dereferencedData;
if ( transforms != null ) {
List<Transform> transformList = ((TransformsType)transforms).getTransform();
if ( transformList != null ) {
for (int i = 0, size = transformList.size(); i < size; i++) {
Transform transform = (Transform) transformList.get(i);
try {
if (i < size - 1) {
data = transform.transform(data, context);
} else {
data = transform.transform(data, context, os);
}
} catch (TransformException te) {
logger.log(Level.SEVERE,LogStringsMessages.WSS_1759_TRANSFORM_ERROR(te.getMessage()),te);
throw new XMLSignatureException(te);
}
}
}
}
try {
os.flush();
dos.flush();
} catch (IOException ex) {
logger.log(Level.SEVERE,LogStringsMessages.WSS_1761_TRANSFORM_IO_ERROR(),ex);
throw new XMLSignatureException(ex);
}
return dos.getDigestValue();
}