I have a document that is digitally signed using CAdES. I use BouncyCastle APIs to get the X509Certificate[]
instances of the signers, but let's assume the list contains one and one only element.
I need to verify whether this certificate is trusted or not at today's date, and I don't want to use the system's standard trust store which is normally used to trust SSL certificates. No, I want to build my own trust list with a list of .cer
files in my classpath. At the moment, a single CA is trusted but obviously in the future a few more certificates may be added.
So far I have read this and tried to implement in my code. I need no SSLContext
, I need to check the validity of a digitally signed document. I am now confused.
X509TrustManager
APIs do however provide only methods for validating client/server certificates, but mine only have digital signature/non-repudiation usage flags.
The questions can be formulated in two ways that lead to the same:
- How does one in Java check the validity of an
X509Certificate
instance against a custom root CA list that can be loaded in memory? - How does one check that a digitally-signed document is signed with a certificate deriving from a known CA of a custom list?