(KeyStore.TrustedCertificateEntry) ks.getEntry(ALIAS_IN_TRUSTSTORE, null);
// Create a DOMValidateContext and specify a KeySelector
// and document context.
DOMValidateContext valContext = new DOMValidateContext
(new X509KeySelector(ks), nl.item(0));
// Create a DOM XMLSignatureFactory that will be used to
// generate the enveloped signature.
XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM");