/** * resolve the URI of type "cid:" , "attachmentRef:", "http:", "#xyz". * @param uriRef {@inheritDoc} * @param context{@inheritDoc} * @throws URIReferenceException {@inheritDoc} * @return {@inheritDoc} */ public Data dereference(final URIReference uriRef, final XMLCryptoContext context) throws URIReferenceException { String uri = null; uri = uriRef.getURI(); if(logger.isLoggable(Level.FINEST)){ logger.log(Level.FINEST, LogStringsMessages.WSS_1750_URI_TOBE_DEREFERENCED(uri)); } return dereferenceURI(uri, context); }
public Data dereference(URIReference uriRef, XMLCryptoContext context) throws URIReferenceException { try{ String uri = null; uri = uriRef.getURI(); return dereferenceURI(uri,context); }catch(Exception ex){ // log here throw new URIReferenceException(ex); } } Data dereferenceURI(String uri, XMLCryptoContext context) throws URIReferenceException{
public Data dereference (URIReference uriRef, XMLCryptoContext context) throws URIReferenceException { try{ String uri = null; uri = uriRef.getURI (); return dereferenceURI (uri,context); }catch(Exception ex){ throw new URIReferenceException (ex); } } Data dereferenceURI (String uri, XMLCryptoContext context) throws URIReferenceException{
public Data dereference(URIReference uriRef, XMLCryptoContext context) throws URIReferenceException { try{ String uri = null; uri = uriRef.getURI(); return dereferenceURI(uri,context); }catch(Exception ex){ // log here throw new URIReferenceException(ex); } } Data dereferenceURI(String uri, XMLCryptoContext context) throws URIReferenceException{
@Override public Data dereference(final URIReference uriReference, final XMLCryptoContext context) throws URIReferenceException { String uri = uriReference.getURI(); // TODO: Following the test case: XAdESTest003 test: testTDetached() the URI can be like: should we accept this URI and what about the baseURI ? // <ds:Reference Id="Reference0" URI="./TARGET_BBB.bin"> // The following rule was added to comply this functionality: // BEGIN: if (uri.startsWith("./")) { uri = uri.substring(2); } // :END if (!uri.equals(documentURI)) { final URIDereferencer uriDereferencer = factory.getURIDereferencer(); final Data data = uriDereferencer.dereference(uriReference, context); if (LOG.isInfoEnabled()) { LOG.info("--> Reference dereferenced: " + uriReference.getURI() + "=" + (data != null) + " | Reference type: " + uriReference.getType()); } return data; } if(document==null) { return null; } final InputStream octetStream = document.openStream(); return new OctetStreamData(octetStream); } }
public Data dereference(URIReference uriReference, XMLCryptoContext context) throws URIReferenceException { if (null == uriReference) { throw new NullPointerException("URIReference cannot be null"); } if (null == context) { throw new NullPointerException("XMLCrytoContext cannot be null"); } String uri = uriReference.getURI(); try { uri = URLDecoder.decode(uri, "UTF-8"); } catch (UnsupportedEncodingException e) { LOG.warn("could not URL decode the uri: " + uri); } LOG.debug("dereference: " + uri); try { InputStream dataInputStream = findDataInputStream(uri); if (null == dataInputStream) { LOG.debug("cannot resolve, delegating to base DOM URI dereferencer: " + uri); return this.baseUriDereferencer.dereference(uriReference, context); } return new OctetStreamData(dataInputStream, uri, null); } catch (IOException e) { throw new URIReferenceException("I/O error: " + e.getMessage(), e); } }
@Override public Data dereference(final URIReference uriReference, final XMLCryptoContext context) throws URIReferenceException { if (null == uriReference) { throw new IllegalArgumentException("La referencia no puede ser nula"); //$NON-NLS-1$ } if (null == context) { throw new IllegalArgumentException("El contexto de firma no puede ser nulo"); //$NON-NLS-1$ } String uri = uriReference.getURI(); try { uri = URLDecoder.decode(uri, StandardCharsets.UTF_8.name()); } catch (final UnsupportedEncodingException e) { Logger.getLogger("es.gob.afirma").warning("No se puede decodificar la URI '" + uri + "': " + e); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } try ( final InputStream dataInputStream = findDataInputStream(uri); ) { if (null == dataInputStream) { return this.baseUriDereferencer.dereference(uriReference, context); } final byte[] data = AOUtil.getDataFromInputStream(dataInputStream); dataInputStream.close(); return new OctetStreamData(new ByteArrayInputStream(data), uri, null); } catch (final IOException e) { throw new URIReferenceException("Error de I/O: " + e, e); //$NON-NLS-1$ } }
String uri = uriReference.getURI(); try { uri = URLDecoder.decode(uri, "UTF-8");
String uri = uriReference.getURI(); try { uri = URLDecoder.decode(uri, "UTF-8");
String uri = uriReference.getURI(); try { uri = URLDecoder.decode(uri, "UTF-8");
String uri = uriRef.getURI(); DOMCryptoContext dcc = (DOMCryptoContext) context; String baseURI = context.getBaseURI();
final String uri = domRef.getURI(); if (uri.startsWith("http://") || uri.startsWith("https://")) { //$NON-NLS-1$ //$NON-NLS-2$ Logger.getLogger("es.gob.afirma").info("Se ha pedido dereferenciar una URI externa: " + uri); //$NON-NLS-1$//$NON-NLS-2$
public Data dereference(URIReference uRIReference, XMLCryptoContext xMLCryptoContext) throws URIReferenceException { String tmpId = uRIReference.getURI();
final String uri = domRef.getURI(); if (uri.startsWith("http://") || uri.startsWith("https://")) { //$NON-NLS-1$ //$NON-NLS-2$ Logger.getLogger("es.gob.afirma").info("Se ha pedido dereferenciar una URI externa: " + uri); //$NON-NLS-1$//$NON-NLS-2$