Xades4j : SignedProperties reference not found - xades4j

I'm trying to validate Xades signatures using Xades4j.
Some of those signatures are generated by another tool (which is not Xades4j) and those signatures have no Type attribute in the Reference tag :
<ds:Reference URI="#signedProps">
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<ds:DigestValue>KUAGWItLLNF6sNZ3kXy+/6oJyEo=</ds:DigestValue>
</ds:Reference>
i've got this Exception when i try to validate it :
xades4j.verification.QualifyingPropertiesIncorporationException: SignedProperties reference not found
at xades4j.verification.SignatureUtils.processReferences(SignatureUtils.java:221)
at xades4j.verification.XadesVerifierImpl.verify(XadesVerifierImpl.java:132)
at com.jeremp.x4j.App.verify(App.java:110)
at com.jeremp.x4j.App.main(App.java:70)
I looked into the source code of SignatureUtils.java and it seems that the API use the Type attribute to identify the Reference tag.
Is there a way to validate this kind of signature with xades4j ?

There's no way to validate those signatures using xades4j, unless you change the source code. I wouldn't recommend this since the XAdES spec clearly states that the Type attribute is mandatory. From section 6.3.1:
Additionally, the present document MANDATES the use of the Type attribute of this particular ds:Reference
element, with its value set to http://uri.etsi.org/01903#SignedProperties.

Related

when use [name] vs [attr.name]?

Does anyone know why you can use [id] and you must use [attr.contenteditable] as property binding in Angular?
I have researched for some time and I can't find an answer.
Why some html native attributes can be modified just with its name while others need to be modified through the attr property?
(This answer assumes you're binding to a HTMLElement rather than an in-app model object. Given the [attr.{name}]-syntax is only supported for DOM HTMLElement objects this assumption should stand)
When working with the DOM, the DOM interfaces for certain elements define first-class/native properties (as in JavaScript properties) for certain HTML attributes.
For example, the HTMLElement DOM interface defines a first-class property id, which is why you can directly use it in a binding expression: [id]. Similarly the HTMLAnchorElement exposes the href property.
(I note that contenteditable is a a defined DOM interface property in WHATWG HTML LS, but not the W3C's DOM specs, interesting...)
However, arbitrary (ultra-modern, user-defined, and obsolete) HTML attributes are not exposed through DOM interfaces and so can can only be accessed via the attributes collection in the DOM. Angular requires you to use [attr.{name}] for non-DOM-property attributes so that it knows it has to use the attributes collection instead of assuming it can bind directly to a DOM property.
To answer your question more directly:
when use [name] vs [attr.name]?
Follow this flow-chart:
Is the value I'm after exposed as a DOM interface property?
Yes:
Use [propertyName]
No:
Is the value I'm after a HTML attribute without a corresponding DOM interface property?
Yes: Use [attr.{attributeName}]
No: Quit your job and let someone else deal with the emotional and mental stresses of the fast-moving JavaScript developer ecosystem.
From the docs
Though the target name is usually the name of a property, there is an automatic attribute-to-property mapping in Angular for several common attributes. These include class/className, innerHtml/innerHTML, and tabindex/tabIndex.
So not all attributes are mapped within Angular.
Using the attr. prefix will literally emit the suffix as a string attribute.
Take this example:
<div [attr.data-my-attr]="value"></div>
Will produce the following HTML, assuming that the component property value has a value of 5:
<div data-my-attr="5">
</div>
Why you must use [attr.contenteditable]="editable"?
This isn't true. This is one way of emitting the contenteditable="true" attribute. Another is to use the Angular attribute [contentEditable]="editable", assuming some component property editable exists.
<div [contentEditable]="editable"></div>
DEMO: https://stackblitz.com/edit/angular-ujd5cf
The reason is because most common HTML attributes have special #Input properties in angular itself. E.g. id class etc, but there are way too many attributes to have this for each of them, so those more specific require you to use attr. syntax. The same thing happens with shorthand binding e.g. [style.width.px], you cannot do this with every single property. Event bindings have similar behavior. E.g. you can say (keyup.enter) but not (keyup.j). Angular tries to make your life easier when it can with most common things, but it also provides option to do other things as well.
This also means that you can do e.g. [attr.id]=

HTML in DSpace messages

We like to add HTML-layout to eMail messages as send by DSpace. Simple adding HTML-tags to one of the eMail templates as 'subscription' does not work.
I suppose we have to do some Java programming, but I have no idea where to start.
Does anyone of you has experience with HTML in DSpace eMails?
Adding HTML tags in the EMail can be done, but this requires some changes to the default EMail class.
It consists of the following changes:
When setting the text on the actual message sent, an additional subType can be added (Check : https://github.com/DSpace/DSpace/blob/master/dspace-api/src/main/java/org/dspace/core/Email.java#L293). By default this takes a text and the charset, but has an additional "subType". Setting this to "html" enables the message to properly check for tags.
In the "EMail" class, you could add an additional "subType" variable which defaults to "plain" for example, and can be overwritten through a setter. (I'd refrain from simply setting it to html for every email template as the checking for existing tags might break other templates and also take some extra time).
The actual code that calls the "subscription" template can then create the mail and set the subtype properly.
See example images for the difference between the "plain" and "html" subtype.
"plain" subtype vs "html" subtype

HTML do I need a mime type for the link tag?

David crockford recommends ommitting the type="application/javascript" attribute for the script tag. Should I do the same for a CSS link tag (omit "type=text/css")? I googled "html link omit mime type" and some variants and didn't find anything
Per documentation for <script>:
The type attribute gives the language of the script or format of the data. If the attribute is present, its value must be a valid MIME type. The charset parameter must not be specified. The default, which is used if the attribute is absent, is "text/javascript".
Now, let's take a look at <link>:
The default value for the type attribute, which is used if the attribute is absent, is "text/css".
The specification is not clear on this for some reason, but it does contain this:
Since that default type is text/css...
The type attribute is also purely advisory. Modern browsers definitely don't need it if it's valid CSS.
There is no practical reason to use the type attribute in either script or link elements, when you are using JavaScript and CSS, as you are (almost always). However, if there is an external requirement imposed upon you to conform to the HTML 4.01 specification, use type="text/javascript" in script, and double-check that you enter it correctly.
Those attributes are never needed (for JavaScript and CSS), but they hurt you if you misspell them. Then browsers will expect that your script is in text/javascript or your style sheet is in text/ccs and ignore it, since they do not know such languages.
In a script element, you would need a type attribute only if the content is not to be interpreted as JavaScript but e.g. as VBScript or not interpreted at all, just stored as data.

How can I convert this into data-attributes?

I'm confused with data-attributes and my task is to convert this into a html5 valid code:
<xy:search campaign="campaign-name" width="280px" height="32px">
</xy:search>
This is an advertisement and recently we wanted to validate our page but this is the last error I couldn't fix, because of the custom dtd element.
I don't want to write custom dtd file, and yes, this code must be work exactly like before changes, they have a script for this custom element, so I just want to modify the base code and "translate" it to the validator, so the element must be visible/readable somehow for the advertisor's script.
I think it can be solved with html5 data-attributes, but I don't know that method...
Any help would be appriciated.
Assuming campaign it the only attribute you need to convert... it is as simple as prepending data- to the attribute. That's all a data attribute is. Example:
<xy:search data-campaign="campaign-name" width="280px" height="32px">
And then to access the value in something like jQuery, you would use .data():
$("your element").data("campaign"); // getter
$("your element").data("campaign","new value"); // setter

What is this data-folder attribute?

I am seeing an anchor tag with a data-folder attribute. What is this for? I researched it but found no info on it.
Also, I see that it has a data-toggle="dropdown" attribute. I researched that and see that it is a HTML 5 attribute used with the Bootstrap jQuery plugin (dropdown.js). So it's: data-toggle="dropdown".
Departments<span class=" caret"></span>
data-folder is custom made data-* attribute that later is used by some other tool, like CSS or JS/jQuery.
By the name of this attribute folder we can tell that it's indicating some reference to folder on server system (maybe ID of departments group?). Not knowing more about what you use we can't tell exactly.
If you are using one of supportable libraries (like jQuery), than you can use Visual Events to check what events does this specific element has.
This is a Custom Data Attribute as specified in W3C HTML5 specification.
Some libraries have methods developed around these type of attributes for easy storing and retrieval of data. Look at the JQuery .data method. This method retrieves/stores values via data attributes.
In your case the the following statement will return the value 4590.
$('<a>').data('folder')