org.apache.xml.security.Init Java Examples
The following examples show how to use
org.apache.xml.security.Init.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConfigurationModuleXmlSec.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
public void init(Configuration config) throws TechnicalConnectorException { LOG.debug("Initializing ConfigurationModule " + this.getClass().getName()); if (!Init.isInitialized()) { LOG.info("Initializing xmlsec"); Init.init(); LOG.info("Setting jsr105Provider with value [org.apache.jcp.xml.dsig.internal.dom.XMLDSigRI]"); this.oldValues.put("jsr105Provider", System.getProperty("jsr105Provider")); System.setProperty("jsr105Provider", "org.apache.jcp.xml.dsig.internal.dom.XMLDSigRI"); } }
Example #2
Source File: ConfigurationModuleXmlSec.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
public void init(Configuration config) throws TechnicalConnectorException { LOG.debug("Initializing ConfigurationModule " + this.getClass().getName()); if (!Init.isInitialized()) { LOG.info("Initializing xmlsec"); Init.init(); LOG.info("Setting jsr105Provider with value [org.apache.jcp.xml.dsig.internal.dom.XMLDSigRI]"); this.oldValues.put("jsr105Provider", System.getProperty("jsr105Provider")); System.setProperty("jsr105Provider", "org.apache.jcp.xml.dsig.internal.dom.XMLDSigRI"); } }
Example #3
Source File: ConfigurationModuleXmlSec.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
public void init(Configuration config) throws TechnicalConnectorException { LOG.debug("Initializing ConfigurationModule " + this.getClass().getName()); if (!Init.isInitialized()) { LOG.info("Initializing xmlsec"); Init.init(); LOG.info("Setting jsr105Provider with value [org.apache.jcp.xml.dsig.internal.dom.XMLDSigRI]"); this.oldValues.put("jsr105Provider", System.getProperty("jsr105Provider")); System.setProperty("jsr105Provider", "org.apache.jcp.xml.dsig.internal.dom.XMLDSigRI"); } }
Example #4
Source File: ConfigurationModuleXmlSec.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
public void init(Configuration config) throws TechnicalConnectorException { LOG.debug("Initializing ConfigurationModule " + this.getClass().getName()); if (!Init.isInitialized()) { LOG.info("Initializing xmlsec"); Init.init(); LOG.info("Setting jsr105Provider with value [org.apache.jcp.xml.dsig.internal.dom.XMLDSigRI]"); this.oldValues.put("jsr105Provider", System.getProperty("jsr105Provider")); System.setProperty("jsr105Provider", "org.apache.jcp.xml.dsig.internal.dom.XMLDSigRI"); } }
Example #5
Source File: ConfigurationModuleXmlSec.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
public void init(Configuration config) throws TechnicalConnectorException { LOG.debug("Initializing ConfigurationModule " + this.getClass().getName()); if (!Init.isInitialized()) { LOG.info("Initializing xmlsec"); Init.init(); LOG.info("Setting jsr105Provider with value [org.apache.jcp.xml.dsig.internal.dom.XMLDSigRI]"); this.oldValues.put("jsr105Provider", System.getProperty("jsr105Provider")); System.setProperty("jsr105Provider", "org.apache.jcp.xml.dsig.internal.dom.XMLDSigRI"); } }
Example #6
Source File: SignatureUnmarshaller.java From lams with GNU General Public License v2.0 | 5 votes |
/** Constructor. */ public SignatureUnmarshaller() { if (!Init.isInitialized()) { log.debug("Initializing XML security library"); Init.init(); } }
Example #7
Source File: SignatureMarshaller.java From lams with GNU General Public License v2.0 | 5 votes |
/** Constructor. */ public SignatureMarshaller() { if (!Init.isInitialized()) { log.debug("Initializing XML security library"); Init.init(); } }
Example #8
Source File: DefaultBootstrap.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Initializes the Apache XMLSecurity libary. * * @throws ConfigurationException thrown is there is a problem initializing the library */ protected static void initializeXMLSecurity() throws ConfigurationException { Logger log = getLogger(); String lineBreakPropName = "org.apache.xml.security.ignoreLineBreaks"; // Don't override if it was set explicitly if (System.getProperty(lineBreakPropName) == null) { System.setProperty(lineBreakPropName, "true"); } if (!Init.isInitialized()) { log.debug("Initializing Apache XMLSecurity library"); Init.init(); } }
Example #9
Source File: MerlinWithCRLDistributionPointsExtension.java From eet-client with MIT License | 5 votes |
private void configureSystemProperties() { Init.init(); final boolean crlDownloadEnabled = Boolean.getBoolean("com.sun.security.enableCRLDP"); final boolean checkRevocationEnabled = Boolean.getBoolean("com.sun.net.ssl.checkRevocation"); final String value = Security.getProperty("com.sun.security.onlyCheckRevocationOfEECert"); final boolean onlyCheckRevocationOfEECert = (value != null) && value.equalsIgnoreCase("true"); if (!crlDownloadEnabled || !checkRevocationEnabled || !onlyCheckRevocationOfEECert) { logger.info("System properties will be configured to enable certificate revocation checks."); System.setProperty("com.sun.security.enableCRLDP", "true"); System.setProperty("com.sun.net.ssl.checkRevocation", "true"); Security.setProperty("com.sun.security.onlyCheckRevocationOfEECert", "true"); // verify only revocation of the last cert in path (the EET cert) } }
Example #10
Source File: XMLHelpers.java From SAMLRaider with MIT License | 5 votes |
/** * Sign assertions in SAML message * * @param document * Document in assertions should be signed * @param signAlgorithm * Signature algorithm in uri form, default if an unknown * algorithm is provided: * http://www.w3.org/2001/04/xmldsig-more#rsa-sha256 * @param digestAlgorithm * Digest algorithm in uri form, default if an unknown algorithm * is provided: http://www.w3.org/2001/04/xmlenc#sha256 */ public void signAssertion(Document document, String signAlgorithm, String digestAlgorithm, X509Certificate cert, PrivateKey key) throws CertificateException, FileNotFoundException, NoSuchAlgorithmException, InvalidKeySpecException, MarshalException, XMLSignatureException, IOException { try { if(Thread.currentThread().getContextClassLoader() == null){ Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); } setIDAttribute(document); XPath xpath = XPathFactory.newInstance().newXPath(); XPathExpression expr = xpath.compile("//*[local-name()='Assertion']/@ID"); NodeList nlURIs = (NodeList) expr.evaluate(document, XPathConstants.NODESET); String[] sigIDs = new String[nlURIs.getLength()]; for (int i = 0; i < nlURIs.getLength(); i++) { sigIDs[i] = nlURIs.item(i).getNodeValue(); } Init.init(); for (String id : sigIDs) { signElement(document, id, cert, key, signAlgorithm, digestAlgorithm); } } catch (XPathExpressionException e) { e.printStackTrace(); } }
Example #11
Source File: XMLHelpers.java From SAMLRaider with MIT License | 5 votes |
/** * Sign whole SAML Message * * @param document * Document with the response to sign * @param signAlgorithm * Signature algorithm in uri form, default if an unknown * algorithm is provided: * http://www.w3.org/2001/04/xmldsig-more#rsa-sha256 * @param digestAlgorithm * Digest algorithm in uri form, default if an unknown algorithm * is provided: http://www.w3.org/2001/04/xmlenc#sha256 */ public void signMessage(Document document, String signAlgorithm, String digestAlgorithm, X509Certificate cert, PrivateKey key) throws CertificateException, FileNotFoundException, NoSuchAlgorithmException, InvalidKeySpecException, MarshalException, XMLSignatureException, IOException { try { if(Thread.currentThread().getContextClassLoader() == null){ Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); } setIDAttribute(document); XPath xpath = XPathFactory.newInstance().newXPath(); XPathExpression expr = xpath.compile("//*[local-name()='Response']/@ID"); NodeList nlURIs = (NodeList) expr.evaluate(document, XPathConstants.NODESET); String[] sigIDs = new String[nlURIs.getLength()]; for (int i = 0; i < nlURIs.getLength(); i++) { sigIDs[i] = nlURIs.item(i).getNodeValue(); } Init.init(); for (String id : sigIDs) { signElement(document, id, cert, key, signAlgorithm, digestAlgorithm); } } catch (XPathExpressionException e) { e.printStackTrace(); } }
Example #12
Source File: SantuarioInitializer.java From dss with GNU Lesser General Public License v2.1 | 5 votes |
/** * Method isInitialized * * @return true if the library is already initialized. */ public static final synchronized boolean isInitialized() { if (Init.isInitialized()) { LOG.info("Santuario is already initialized with its default configuration"); return true; } return SantuarioInitializer.alreadyInitialized; }