/** * Method getReferencedBytes * * @return the bytes that will be used to generated digest. * @throws ReferenceNotInitializedException * @throws XMLSignatureException */ public byte[] getReferencedBytes() throws ReferenceNotInitializedException, XMLSignatureException { try { XMLSignatureInput output = this.dereferenceURIandPerformTransforms(null); return output.getBytes(); } catch (IOException ex) { throw new ReferenceNotInitializedException(ex); } catch (CanonicalizationException ex) { throw new ReferenceNotInitializedException(ex); } }
/** * This method returns the {@link XMLSignatureInput} which is referenced by the * <CODE>URI</CODE> Attribute. * @param os where to write the transformation can be null. * @return the element to digest * * @throws XMLSignatureException * @see Manifest#verifyReferences() */ protected XMLSignatureInput dereferenceURIandPerformTransforms(OutputStream os) throws XMLSignatureException { try { XMLSignatureInput input = this.getContentsBeforeTransformation(); cacheDereferencedElement(input); XMLSignatureInput output = this.getContentsAfterTransformation(input, os); this.transformsOutput = output; return output; } catch (XMLSecurityException ex) { throw new ReferenceNotInitializedException(ex); } }
throw new ReferenceNotInitializedException(ex); } catch (ParserConfigurationException ex) { throw new ReferenceNotInitializedException(ex); } catch (SAXException ex) { throw new ReferenceNotInitializedException(ex);
/** * Returns the XMLSignatureInput which is created by de-referencing the URI attribute. * @return the XMLSignatureInput of the source of this reference * @throws ReferenceNotInitializedException If the resolver found any * problem resolving the reference */ public XMLSignatureInput getContentsBeforeTransformation() throws ReferenceNotInitializedException { try { Attr uriAttr = getElement().getAttributeNodeNS(null, Constants._ATT_URI); ResourceResolver resolver = ResourceResolver.getInstance( uriAttr, this.baseURI, this.manifest.getPerManifestResolvers(), secureValidation ); resolver.addProperties(this.manifest.getResolverProperties()); return resolver.resolve(uriAttr, this.baseURI, secureValidation); } catch (ResourceResolverException ex) { throw new ReferenceNotInitializedException(ex); } }
throw new ReferenceNotInitializedException(ex); } catch (IOException ex) { throw new ReferenceNotInitializedException(ex);