Xades4j - Unrecognized critical extension(s) in CRL - xades4j

I'm using xades4j to verify a Signature. The CRL has two critical extensions (2.5.29.20, 2.5.29.35) and xades4j API reject the CRL.
Exception that throw xades4j API:
xades4j.providers.CannotBuildCertificationPathException: unable to find valid certification path to requested target
xades4j.providers.impl.PKIXCertificateValidationProvider.validate(PKIXCertificateValidationProvider.java:268)
xades4j.verification.XadesVerifierImpl.verify(XadesVerifierImpl.java:175)
How can I add an object identifier (OID) in xades4j?

TL;DR;: I don't think this is possible.
From the docs I was able to find, namely Java PKI Guide, additional OIDs can be handled using PKIXCertPathChecker. Currently, xades4j's PKIXCertificateValidationProvider doesn't include a way to register new checkers.
Do you know any other way this could be done?

Related

Authority "AUTO" is unknown or doesn't match the supplied hints. Maybe it is defined in an unreachable JAR file?

I am working on a project related to Coordinate Reference Systems (CRS) using geoTools. I am getting 'NoSuchAuthorityCodeException' exception with the above message while executing my jar. Things work fine when using EPSG CRS Authority. Fails when I specify 'AUTO:42001' CRSAuthorityFactory. Is there any Library/plug-in to be used. ?
Below is the Exception
at
org.geotools.referencing.factory.ManyAuthoritiesFactory.noSuchAuthority(ManyAuthoritiesFactory.java:489)
at org.geotools.referencing.factory.ManyAuthoritiesFactory.getAuthorityFactory(ManyAuthoritiesFactory.java:467)
at org.geotools.referencing.factory.ManyAuthoritiesFactory.getCRSAuthorityFactory(ManyAuthoritiesFactory.java:548)
at org.geotools.referencing.factory.AuthorityFactoryAdapter.createCoordinateReferenceSystem(AuthorityFactoryAdapter.java:801)
at org.geotools.referencing.factory.ThreadedAuthorityFactory.createCoordinateReferenceSystem(ThreadedAuthorityFactory.java:731)
at org.geotools.referencing.DefaultAuthorityFactory.createCoordinateReferenceSystem(DefaultAuthorityFactory.java:179)
at org.geotools.referencing.CRS.decode(CRS.java:519)

Know intended RestController in Spring implementation of ResponseBodyAdvice

The Spring ResponseBodyAdvice allows for handling the JSON-Response. I want to write it to the logger but by this would also like to add the name of the RestController being invoked in this transaction.
Can anyone tell, whether the classname is somewhere available in the parameters of the instance of ResponseBodyAdvice.
Got it. The parameter "MethodParameter" supplied to the "beforeBodyWrite"-method contains the attribute "containingClass" which provides the name of the intended Controller (I found this with testing - did not find any docs about the use of this attribute until now). That will do for me

ConcurrentModificationException in Android while accessing Shared Preferences

When I develop an android app, I run into the exception which I do not have any clue; I have googled related topics but none of them helped.
Fatal Exception: java.util.ConcurrentModificationException
java.util.HashMap$HashIterator.nextEntry (HashMap.java:806)
java.util.HashMap$KeyIterator.next (HashMap.java:833)
com.android.internal.util.XmlUtils.writeSetXml (XmlUtils.java:298)
com.android.internal.util.XmlUtils.writeValueXml (XmlUtils.java:447)
com.android.internal.util.XmlUtils.writeMapXml (XmlUtils.java:241)
com.android.internal.util.XmlUtils.writeMapXml (XmlUtils.java:181)
android.app.SharedPreferencesImpl.writeToFile (SharedPreferencesImpl.java:596)
android.app.SharedPreferencesImpl.access$800 (SharedPreferencesImpl.java:52)
android.app.SharedPreferencesImpl$2.run (SharedPreferencesImpl.java:511)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1112)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:587)
java.lang.Thread.run (Thread.java:841)
Preferences are thread safe(!), but not process safe. The answer of
#mohan mishra simply not true, no need to synchronize everything. The problem here, as statet out in another question is, that per documentation you MUST NOT modify any instance that is returned by getStringSet and getAll
getStringSet()
Note that you must not modify the set instance returned by this call.
The consistency of the stored data is not guaranteed if you do, nor is
your ability to modify the instance at all.
getAll()
Note that you must not modify the collection returned by this method,
or alter any of its contents. The consistency of your stored data is
not guaranteed if you do.
To the other question
Documentation
Please ensure that you are not accessing the preferences from any type of background thread. Also all your methods to add to preference must be synchronised(if you have your own preference managing class)

Handle specific exception that is not related to an exchange

I created a custom component for a proprietary service. If this service is down i get noticed via a call of a callback function. I am throwing a custom exception at this point.
Sending exchanges to the producer/ consumer will yield no errors or exceptions (all seems to fine).
So i need to implement an emergency stop if my custom exception is thrown. I read a bit about exception handling in camel. I think i need a context-scoped onException(MyException.class).??? but what then?
Is this working on exceptions that are called without relation to an exchange? If this is working how to handle it. I want to stop certain routes in this case.
here you can find to stop routes from a route: http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html.
If you do the call of the proprietary service in a route you do have an exchange btw.
kind regards,
soilworker
I created a little workaround: I set a boolean i the callback method is called. On each call of process i check this boolean and if true i throw an exception.
With this the exception is within normal camel exception handling and onException could be used.

How can I intercept uncaught exceptions on Tomcat?

I am trying to figure out a clean way to intercept uncaught exceptions that occur in my application.
I have log4j configured for logging the normal application flow and caught exceptions, so that is taken care of. Right now, I have a class that takes all error-level messages and adds them to a queue to be emailed in batches.
Ideally, I'm hoping that there is a way I can go about intercepting the uncaught exceptions, so that I may pass them to the same 'email batch' queue, but if this is not posible, I'm certainly open to suggestion.
I'm familiar with LogInterceptors on JBoss, but this project is using Tomcat. Is there any way that I might go about this? Is there a LogInterceptor equivelant for Tomcat? Should I try to redirect the Tomcat logging to a custom appender? (If so - any hints on that?) Some other ideas?
I figured that this has to be a solved problem by now, so I am hoping to tap some collective wisdom. Thanks, everyone, in advance.
Per the J2EE 1.4 spec, uncaught exceptions within a servlet may be forwarded to an error page as defined in the deployment descriptor. When this happens, the page implementation will receive the original request and response objects, with the addition of a request attribute named javax.servlet.error.exception that contains the exception object.
That said, I have not actually done this with Tomcat, and most of the web applications that I've worked on forward to a generic error page at the webserver level.
Edit: just tried it out on my local server, after adding the following to my web.xml, and it works as advertised:
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/dumpRequest.jsp</location>
</error-page>
It's not Tomcat-specific, but you can set uncaught exception handlers on a per-thread basis.
Depending on the setup of your application, you could set this at the top of your method that handles a request. You might have to do it every time, as you may get a thread per request.
A good place to set it would be in some sort of front controller.