Check if a cert is trusted

For my thesis I have to check if a cert is trusted within Firefox. It is not a TLS key, but a public key that was used to sign a message and is available as a hex string or byte array or PEM.

I already found the nsIX509Cert Interface but I have no idea how to import the key.

Is there any possibility to achieve this with nsIX509Cert, nsIX509CertDB oder any other interface?

Answering it myself:

The constructX509FromBase64() method of nsIX509CertDB can be used to import a certificate structure (see example in image)

Then getUsagesArray() of nsIX509Cert validates the certificate.