diff --git a/smp-api/src/test/java/eu/europa/ec/smp/api/GeneratedCodeTest.java b/smp-api/src/test/java/eu/europa/ec/smp/api/GeneratedCodeTest.java
index d9039e75e122013d14e3cf27b5832d6fa51114b4..55da9a45bab4e2114073057a6ccce3bac417fa55 100644
--- a/smp-api/src/test/java/eu/europa/ec/smp/api/GeneratedCodeTest.java
+++ b/smp-api/src/test/java/eu/europa/ec/smp/api/GeneratedCodeTest.java
@@ -92,4 +92,52 @@ public class GeneratedCodeTest {
         return (ServiceGroup) serviceGroup;
     }
 
+    @Test
+    public void testGeneratedServiceGroupEqualsReturnsTrue(){
+        ParticipantIdentifierType id1 = new ParticipantIdentifierType(VALUE, SCHEME);
+        ParticipantIdentifierType id2 = new ParticipantIdentifierType(VALUE, SCHEME);
+
+        assertTrue(id1.equals(id2));
+    }
+
+    @Test
+    public void testGeneratedServiceGroupEqualsIsCaseSensitive(){
+        ParticipantIdentifierType id1 = new ParticipantIdentifierType("Value", "Scheme");
+        ParticipantIdentifierType id2 = new ParticipantIdentifierType("value", "scheme");
+
+        assertFalse(id1.equals(id2));
+    }
+
+    @Test
+    public void testGeneratedServiceGroupEquaHandlesEmptyScheme(){
+        ParticipantIdentifierType id1 = new ParticipantIdentifierType(VALUE, null);
+        ParticipantIdentifierType id2 = new ParticipantIdentifierType(VALUE, null);
+
+        assertTrue(id1.equals(id2));
+    }
+
+    @Test
+    public void testGeneratedDocumentIdEqualsReturnsTrue(){
+        DocumentIdentifier id1 = new DocumentIdentifier(VALUE, SCHEME);
+        DocumentIdentifier id2 = new DocumentIdentifier(VALUE, SCHEME);
+
+        assertTrue(id1.equals(id2));
+    }
+
+    @Test
+    public void testGeneratedDocumentIdEqualsIsCaseSensitive(){
+        DocumentIdentifier id1 = new DocumentIdentifier("Value", "Scheme");
+        DocumentIdentifier id2 = new DocumentIdentifier("value", "scheme");
+
+        assertFalse(id1.equals(id2));
+    }
+
+    @Test
+    public void testGeneratedDocumentIdEqualsHandlesEmptyScheme(){
+        DocumentIdentifier id1 = new DocumentIdentifier(VALUE, null);
+        DocumentIdentifier id2 = new DocumentIdentifier(VALUE, null);
+
+        assertTrue(id1.equals(id2));
+    }
+
 }
diff --git a/smp-server-library/src/main/java/eu/europa/ec/cipa/smp/server/security/Signer.java b/smp-server-library/src/main/java/eu/europa/ec/cipa/smp/server/security/Signer.java
deleted file mode 100644
index 5ac10c7f9e48fd7b2ba7ccb04f6f727e085127b0..0000000000000000000000000000000000000000
--- a/smp-server-library/src/main/java/eu/europa/ec/cipa/smp/server/security/Signer.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright 2017 European Commission | CEF eDelivery
- *
- * Licensed under the EUPL, Version 1.2 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- *
- * You may obtain a copy of the Licence attached in file: LICENCE-EUPL-v1.2.pdf
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and limitations under the Licence.
- */
-
-package eu.europa.ec.cipa.smp.server.security;
-
-import org.w3c.dom.Element;
-
-import javax.annotation.Nonnull;
-import javax.xml.crypto.MarshalException;
-import javax.xml.crypto.dsig.*;
-import javax.xml.crypto.dsig.dom.DOMSignContext;
-import javax.xml.crypto.dsig.keyinfo.KeyInfo;
-import javax.xml.crypto.dsig.keyinfo.KeyInfoFactory;
-import javax.xml.crypto.dsig.keyinfo.X509Data;
-import javax.xml.crypto.dsig.spec.C14NMethodParameterSpec;
-import javax.xml.crypto.dsig.spec.TransformParameterSpec;
-import java.security.InvalidAlgorithmParameterException;
-import java.security.InvalidParameterException;
-import java.security.NoSuchAlgorithmException;
-import java.security.PrivateKey;
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-public class Signer {
-
-    private final PrivateKey privateKey;
-    private final X509Certificate certificate;
-
-    public Signer(@Nonnull final PrivateKey privateKey,
-                  @Nonnull final X509Certificate certificate) {
-        this.privateKey = privateKey;
-        this.certificate = certificate;
-
-        if (this.privateKey == null) {
-            throw new InvalidParameterException("Private key must be not null.");
-        }
-
-        if (this.certificate == null) {
-            throw new InvalidParameterException("Certificate must be not null.");
-        }
-    }
-
-    public void signXML(final Element aElementToSign) throws NoSuchAlgorithmException,
-            InvalidAlgorithmParameterException,
-            MarshalException,
-            XMLSignatureException {
-        // Create a DOM XMLSignatureFactory that will be used to
-        // generate the enveloped signature.
-        final XMLSignatureFactory aSignatureFactory = XMLSignatureFactory.getInstance("DOM");
-
-        // Create a Reference to the enveloped document (in this case,
-        // you are signing the whole document, so a URI of "" signifies
-        // that, and also specify the SHA1 digest algorithm and
-        // the ENVELOPED Transform)
-        final Reference aReference = aSignatureFactory.newReference("",
-                aSignatureFactory.newDigestMethod(DigestMethod.SHA256,
-                        null),
-                Collections.singletonList(aSignatureFactory.newTransform(Transform.ENVELOPED,
-                        (TransformParameterSpec) null)),
-                null,
-                null);
-
-        // Create the SignedInfo.
-        final String RSA_SHA256 = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256";
-        final SignedInfo aSingedInfo = aSignatureFactory.newSignedInfo(aSignatureFactory.newCanonicalizationMethod(CanonicalizationMethod.INCLUSIVE,
-                (C14NMethodParameterSpec) null),
-                aSignatureFactory.newSignatureMethod(RSA_SHA256,
-                        null),
-                Collections.singletonList(aReference));
-
-        // Create the KeyInfo containing the X509Data.
-        final KeyInfoFactory aKeyInfoFactory = aSignatureFactory.getKeyInfoFactory();
-        final List<Object> aX509Content = new ArrayList<Object>();
-        aX509Content.add(certificate.getSubjectX500Principal().getName());
-        aX509Content.add(certificate);
-        final X509Data aX509Data = aKeyInfoFactory.newX509Data(aX509Content);
-        final KeyInfo aKeyInfo = aKeyInfoFactory.newKeyInfo(Collections.singletonList(aX509Data));
-
-        // Create a DOMSignContext and specify the RSA PrivateKey and
-        // location of the resulting XMLSignature's parent element.
-        final DOMSignContext dsc = new DOMSignContext(privateKey, aElementToSign);
-
-        // Create the XMLSignature, but don't sign it yet.
-        final XMLSignature signature = aSignatureFactory.newXMLSignature(aSingedInfo, aKeyInfo);
-
-        // Marshal, generate, and sign the enveloped signature.
-        signature.sign(dsc);
-    }
-}
diff --git a/smp-server-library/src/main/java/eu/europa/ec/cipa/smp/server/util/IdentifierUtils.java b/smp-server-library/src/main/java/eu/europa/ec/cipa/smp/server/util/IdentifierUtils.java
deleted file mode 100644
index e7047769a93c9d494ab733372206b374cd30996b..0000000000000000000000000000000000000000
--- a/smp-server-library/src/main/java/eu/europa/ec/cipa/smp/server/util/IdentifierUtils.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2017 European Commission | CEF eDelivery
- *
- * Licensed under the EUPL, Version 1.2 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- *
- * You may obtain a copy of the Licence attached in file: LICENCE-EUPL-v1.2.pdf
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and limitations under the Licence.
- */
-package eu.europa.ec.cipa.smp.server.util;
-
-import org.oasis_open.docs.bdxr.ns.smp._2016._05.ParticipantIdentifierType;
-
-import javax.annotation.Nonnull;
-import javax.annotation.concurrent.Immutable;
-
-/**
- * This class contains several identifier related utility methods.
- *
- * @author PEPPOL.AT, BRZ, Philip Helger
- */
-@Immutable
-@Deprecated
-public final class IdentifierUtils {
-
-  /**
-   * According to the specification, two participant identifiers are equal if
-   * their parts are equal case insensitive.
-   *
-   * @param aIdentifier1
-   *        First identifier to compare. May not be null.
-   * @param aIdentifier2
-   *        Second identifier to compare. May not be null.
-   * @return <code>true</code> if the identifiers are equal, <code>false</code>
-   *         otherwise.
-   */
-  public static boolean areIdentifiersEqual (@Nonnull final ParticipantIdentifierType aIdentifier1,
-                                             @Nonnull final ParticipantIdentifierType aIdentifier2) {
-
-    if(aIdentifier1==null || aIdentifier2==null){
-      throw new IllegalArgumentException("Null identifiers are not allowed");
-    }
-    // Identifiers are equal, if both scheme and value match case insensitive!
-    return stringEquals(aIdentifier1.getScheme(), aIdentifier2.getScheme ()) &&
-            stringEquals(aIdentifier1.getValue (), aIdentifier2.getValue ());
-
-  }
-
-
-  private static boolean stringEquals(String a, String b){
-    return a==null ? b==null : a.equalsIgnoreCase(b);
-  }
-
-
-
-
-}
diff --git a/smp-server-library/src/main/java/eu/europa/ec/cipa/smp/server/util/SignatureFilter.java b/smp-server-library/src/main/java/eu/europa/ec/cipa/smp/server/util/SignatureFilter.java
deleted file mode 100644
index d89519a55da99e7bc8e635d1ea604a7d5777c973..0000000000000000000000000000000000000000
--- a/smp-server-library/src/main/java/eu/europa/ec/cipa/smp/server/util/SignatureFilter.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright 2017 European Commission | CEF eDelivery
- *
- * Licensed under the EUPL, Version 1.2 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- *
- * You may obtain a copy of the Licence attached in file: LICENCE-EUPL-v1.2.pdf
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and limitations under the Licence.
- */
-package eu.europa.ec.cipa.smp.server.util;
-
-import eu.europa.ec.cipa.smp.server.security.Signer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
-import org.w3c.dom.Document;
-
-import javax.annotation.PostConstruct;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.security.KeyStore;
-import java.security.cert.X509Certificate;
-
-/**
- * This class adds a XML DSIG to successful GET's for SignedServiceMetadata
- * objects.
- *
- * @author PEPPOL.AT, BRZ, Philip Helger
- */
-@Deprecated // TODO: This is no longer a filter, refactor this garbage.
-@Component
-public final class SignatureFilter {
-
-    private static final Logger s_aLogger = LoggerFactory.getLogger(SignatureFilter.class);
-
-    @Value("${xmldsig.keystore.classpath}")
-    private String xmldsigKeystoreClasspath;
-
-    @Value("${xmldsig.keystore.password}")
-    private String xmldsigKeystorePassword;
-
-    @Value("${xmldsig.keystore.key.alias}")
-    private String xmldsigKeystoreKeyAlias;
-
-    @Value("${xmldsig.keystore.key.password}")
-    private String xmldsigKeystoreKeyPassword;
-
-    private KeyStore.PrivateKeyEntry m_aKeyEntry;
-
-    private X509Certificate m_aCert;
-
-    private Signer signer;
-
-    @PostConstruct
-    public void init() {
-        // Load the KeyStore and get the signing key and certificate.
-        try {
-            InputStream keystoreInputStream;
-            try {
-                keystoreInputStream = new FileInputStream(xmldsigKeystoreClasspath);
-            } catch (FileNotFoundException e){
-                s_aLogger.warn("Could not file keystore file, trying loading from classpath: " + xmldsigKeystoreClasspath);
-                keystoreInputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(xmldsigKeystoreClasspath);
-            }
-            KeyStore keyStore = KeyStore.getInstance("JKS");
-            keyStore.load(keystoreInputStream, xmldsigKeystorePassword.toCharArray());
-            final KeyStore.Entry aEntry = keyStore.getEntry(xmldsigKeystoreKeyAlias,
-                    new KeyStore.PasswordProtection(xmldsigKeystoreKeyPassword.toCharArray()));
-            if (aEntry == null) {
-                // Alias not found
-                throw new IllegalStateException("Failed to find key store alias '" +
-                        xmldsigKeystoreKeyAlias +
-                        "' in keystore with password '" +
-                        xmldsigKeystoreKeyPassword +
-                        "'. Does the alias exist? Is the password correct?");
-            }
-            if (!(aEntry instanceof KeyStore.PrivateKeyEntry)) {
-                // Not a private key
-                throw new IllegalStateException("The keystore alias '" +
-                        xmldsigKeystoreKeyAlias +
-                        "' was found in keystore with password '" +
-                        xmldsigKeystorePassword +
-                        "' but it is not a private key! The internal type is " +
-                        aEntry.getClass().getName());
-            }
-            m_aKeyEntry = (KeyStore.PrivateKeyEntry) aEntry;
-            m_aCert = (X509Certificate) m_aKeyEntry.getCertificate();
-            s_aLogger.info("Signature filter initialized with keystore '" +
-                    xmldsigKeystoreClasspath +
-                    "' and alias '" +
-                    xmldsigKeystoreKeyAlias +
-                    "'");
-
-            signer = new Signer(m_aKeyEntry.getPrivateKey(), m_aCert);
-        } catch (final Throwable t) {
-            s_aLogger.error("Error in constructor of SignatureFilter", t);
-            throw new IllegalStateException("Error in constructor of SignatureFilter", t);
-        }
-    }
-
-    public void sign(Document serviceMetadataDoc) {
-        try {
-            signer.signXML(serviceMetadataDoc.getDocumentElement());
-        } catch (Exception e) {
-            throw new RuntimeException("Could not sign serviceMetadata response", e);
-        }
-    }
-
-}
\ No newline at end of file
diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/CommonColumnsLengths.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/CommonColumnsLengths.java
index 675e623a248674c951aab844de55e419bf8a16a7..ca5a584308f5a4a04556290fcb53c5bd1d04736a 100644
--- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/CommonColumnsLengths.java
+++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/CommonColumnsLengths.java
@@ -21,5 +21,4 @@ public class CommonColumnsLengths {
     public static final int MAX_PARTICIPANT_IDENTIFIER_VALUE_LENGTH = 50;
     public static final int MAX_DOCUMENT_TYPE_IDENTIFIER_VALUE_LENGTH = 500;
     public static final int MAX_USERNAME_LENGTH = 256;
-    public static final String URL_SCHEME_VALUE_SEPARATOR = "::";
 }
diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBServiceMetadataId.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBServiceMetadataId.java
index 403e87780b37d489f4db2b9f07bb4d632062e223..74f12d5880b40e14e4396c895f66d2ddede17c45 100644
--- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBServiceMetadataId.java
+++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBServiceMetadataId.java
@@ -32,9 +32,7 @@ public class DBServiceMetadataId implements Serializable {
     private String documentIdScheme;
     private String documentIdValue;
 
-    @Deprecated
-    public DBServiceMetadataId() {
-    }
+    public DBServiceMetadataId() {}
 
     public DBServiceMetadataId(String participantIdScheme,
                                String participantIdValue,
diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/exceptions/DocumentSigningException.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/exceptions/DocumentSigningException.java
new file mode 100644
index 0000000000000000000000000000000000000000..676495a52b06532bae6387394df038b1eb113a89
--- /dev/null
+++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/exceptions/DocumentSigningException.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2018 European Commission | CEF eDelivery
+ *
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ *
+ * You may obtain a copy of the Licence attached in file: LICENCE-EUPL-v1.2.pdf
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and limitations under the Licence.
+ */
+
+package eu.europa.ec.edelivery.smp.exceptions;
+
+/**
+ * Technical issue with signing the document.
+ * <p>
+ * Created by gutowpa on 11/01/2018.
+ */
+public class DocumentSigningException extends RuntimeException {
+    public DocumentSigningException(String msg, Exception e) {
+        super(msg, e);
+    }
+}
diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/sml/SmlIntegrationException.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/exceptions/SmlIntegrationException.java
similarity index 74%
rename from smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/sml/SmlIntegrationException.java
rename to smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/exceptions/SmlIntegrationException.java
index 489d0f44477b91bc4328418187828a626fe27a6b..1155162e548fec2e9a1a1d01b159d6296bd92f4a 100644
--- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/sml/SmlIntegrationException.java
+++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/exceptions/SmlIntegrationException.java
@@ -1,7 +1,7 @@
 /*
- * Copyright 2017 European Commission | CEF eDelivery
+ * Copyright 2018 European Commission | CEF eDelivery
  *
- * Licensed under the EUPL, Version 1.2 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "Licence");
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "Licence");
  * You may not use this work except in compliance with the Licence.
  *
  * You may obtain a copy of the Licence attached in file: LICENCE-EUPL-v1.2.pdf
@@ -11,7 +11,7 @@
  * See the Licence for the specific language governing permissions and limitations under the Licence.
  */
 
-package eu.europa.ec.edelivery.smp.sml;
+package eu.europa.ec.edelivery.smp.exceptions;
 
 /**
  * Problem occurred when integrating with SML
diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ServiceMetadataService.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ServiceMetadataService.java
index e6b2ede003498669e7a96f06be01bd8adaa92ffb..ea87f6faff4edb37caef4ca05d1712a7031b8f37 100644
--- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ServiceMetadataService.java
+++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ServiceMetadataService.java
@@ -15,7 +15,6 @@ package eu.europa.ec.edelivery.smp.services;
 
 import eu.europa.ec.edelivery.smp.conversion.CaseSensitivityNormalizer;
 import eu.europa.ec.edelivery.smp.conversion.ServiceGroupConverter;
-import eu.europa.ec.cipa.smp.server.util.SignatureFilter;
 import eu.europa.ec.edelivery.smp.data.dao.ServiceGroupDao;
 import eu.europa.ec.edelivery.smp.data.dao.ServiceMetadataDao;
 import eu.europa.ec.edelivery.smp.data.model.DBServiceGroup;
@@ -52,7 +51,7 @@ public class ServiceMetadataService {
     private ServiceGroupDao serviceGroupDao;
 
     @Autowired
-    private SignatureFilter signatureFilter;
+    private ServiceMetadataSigner signer;
 
     public Document getServiceMetadataDocument(ParticipantIdentifierType serviceGroupId, DocumentIdentifier documentId) {
         ParticipantIdentifierType normalizedServiceGroupId = caseSensitivityNormalizer.normalize(serviceGroupId);
@@ -65,7 +64,7 @@ public class ServiceMetadataService {
         }
 
         Document aSignedServiceMetadata = toSignedServiceMetadatadaDocument(serviceMetadata.getXmlContent());
-        signatureFilter.sign(aSignedServiceMetadata);
+        signer.sign(aSignedServiceMetadata);
         return aSignedServiceMetadata;
     }
 
diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ServiceMetadataSigner.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ServiceMetadataSigner.java
new file mode 100644
index 0000000000000000000000000000000000000000..32b2b2e7235472386ccdb6d2c369b53a4a0a18d8
--- /dev/null
+++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ServiceMetadataSigner.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright 2018 European Commission | CEF eDelivery
+ *
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ *
+ * You may obtain a copy of the Licence attached in file: LICENCE-EUPL-v1.2.pdf
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and limitations under the Licence.
+ */
+package eu.europa.ec.edelivery.smp.services;
+
+import eu.europa.ec.edelivery.smp.exceptions.DocumentSigningException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.w3c.dom.Document;
+
+import javax.annotation.PostConstruct;
+import javax.xml.crypto.dsig.Reference;
+import javax.xml.crypto.dsig.SignedInfo;
+import javax.xml.crypto.dsig.XMLSignature;
+import javax.xml.crypto.dsig.XMLSignatureFactory;
+import javax.xml.crypto.dsig.dom.DOMSignContext;
+import javax.xml.crypto.dsig.keyinfo.KeyInfo;
+import javax.xml.crypto.dsig.keyinfo.KeyInfoFactory;
+import javax.xml.crypto.dsig.keyinfo.X509Data;
+import javax.xml.crypto.dsig.spec.C14NMethodParameterSpec;
+import javax.xml.crypto.dsig.spec.TransformParameterSpec;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.security.Key;
+import java.security.KeyStore;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.List;
+
+import static java.util.Collections.singletonList;
+import static javax.xml.crypto.dsig.CanonicalizationMethod.INCLUSIVE;
+import static javax.xml.crypto.dsig.DigestMethod.SHA256;
+import static javax.xml.crypto.dsig.Transform.ENVELOPED;
+
+@Component
+public final class ServiceMetadataSigner {
+
+    private static final Logger log = LoggerFactory.getLogger(ServiceMetadataSigner.class);
+
+    private static final String RSA_SHA256 = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256";
+
+    @Value("${xmldsig.keystore.classpath}")
+    private String keystoreFilePath;
+
+    @Value("${xmldsig.keystore.password}")
+    private String keystorePassword;
+
+    @Value("${xmldsig.keystore.key.alias}")
+    private String xmldsigKeystoreKeyAlias;
+
+    @Value("${xmldsig.keystore.key.password}")
+    private String xmldsigKeystoreKeyPassword;
+
+
+    private Key signingKey;
+    private X509Certificate signingCertificate;
+
+
+    private static XMLSignatureFactory getDomSigFactory() {
+        // According to Javadoc, only static methods of this factory are thread-safe
+        // We cannot share and re-use the same instance in every place
+        return XMLSignatureFactory.getInstance("DOM");
+    }
+
+    @PostConstruct
+    public void init() {
+        // Load the KeyStore and get the signing key and certificate.
+        try (InputStream keystoreInputStream = new FileInputStream(keystoreFilePath)) {
+
+            KeyStore keyStore = KeyStore.getInstance("JKS");
+            keyStore.load(keystoreInputStream, keystorePassword.toCharArray());
+
+            signingKey = keyStore.getKey(xmldsigKeystoreKeyAlias, xmldsigKeystoreKeyPassword.toCharArray());
+            signingCertificate = (X509Certificate) keyStore.getCertificate(xmldsigKeystoreKeyAlias);
+
+            log.info("Successfully loaded signing key and certificate: " + signingCertificate.getSubjectDN().getName());
+        } catch (Exception e) {
+            throw new IllegalStateException("Could not load signing certificate with private key from keystore file: " + keystoreFilePath, e);
+        }
+    }
+
+    public void sign(Document serviceMetadataDoc) {
+        try {
+            XMLSignatureFactory domSigFactory = getDomSigFactory();
+
+            // Create a Reference to the ENVELOPED document
+            // URI "" means that the whole document is signed
+            Reference reference = domSigFactory.newReference(
+                    "",
+                    domSigFactory.newDigestMethod(SHA256, null),
+                    singletonList(domSigFactory.newTransform(ENVELOPED, (TransformParameterSpec) null)),
+                    null,
+                    null);
+
+            SignedInfo singedInfo = domSigFactory.newSignedInfo(
+                    domSigFactory.newCanonicalizationMethod(INCLUSIVE, (C14NMethodParameterSpec) null),
+                    domSigFactory.newSignatureMethod(RSA_SHA256, null),
+                    singletonList(reference));
+
+            DOMSignContext domSignContext = new DOMSignContext(signingKey, serviceMetadataDoc.getDocumentElement());
+
+            // Create the XMLSignature, but don't sign it yet
+            KeyInfo keyInfo = createKeyInfo();
+            XMLSignature signature = domSigFactory.newXMLSignature(singedInfo, keyInfo);
+
+            // Marshal, generate, and sign the enveloped signature
+            signature.sign(domSignContext);
+        } catch (Exception e) {
+            throw new DocumentSigningException("Could not sign serviceMetadata response", e);
+        }
+    }
+
+    private KeyInfo createKeyInfo() {
+        KeyInfoFactory keyInfoFactory = getDomSigFactory().getKeyInfoFactory();
+        List content = new ArrayList();
+        content.add(signingCertificate.getSubjectX500Principal().getName());
+        content.add(signingCertificate);
+        X509Data x509Data = keyInfoFactory.newX509Data(content);
+        return keyInfoFactory.newKeyInfo(singletonList(x509Data));
+    }
+
+}
\ No newline at end of file
diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/sml/SmlConnector.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/sml/SmlConnector.java
index 272724b52ea32ddacaae9c8998fcad7a7a79e28a..1e3e1b274836051945d2536098dc9f30e09f78d2 100644
--- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/sml/SmlConnector.java
+++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/sml/SmlConnector.java
@@ -14,6 +14,7 @@
 package eu.europa.ec.edelivery.smp.sml;
 
 import eu.europa.ec.bdmsl.ws.soap.IManageParticipantIdentifierWS;
+import eu.europa.ec.edelivery.smp.exceptions.SmlIntegrationException;
 import org.busdox.servicemetadata.locator._1.ServiceMetadataPublisherServiceForParticipantType;
 import org.oasis_open.docs.bdxr.ns.smp._2016._05.ParticipantIdentifierType;
 import org.slf4j.Logger;
diff --git a/smp-server-library/src/test/java/eu/europa/ec/cipa/smp/server/security/SignatureUtil.java b/smp-server-library/src/test/java/eu/europa/ec/cipa/smp/server/security/SignatureUtil.java
index 4b2cb60e3fed3ea82c39717b7866847230f8de0d..b3e40e3216ac3286503912bb5282002c17e2cc59 100644
--- a/smp-server-library/src/test/java/eu/europa/ec/cipa/smp/server/security/SignatureUtil.java
+++ b/smp-server-library/src/test/java/eu/europa/ec/cipa/smp/server/security/SignatureUtil.java
@@ -30,8 +30,6 @@ import javax.xml.crypto.dsig.keyinfo.KeyInfoFactory;
 import javax.xml.crypto.dsig.keyinfo.X509Data;
 import javax.xml.crypto.dsig.spec.C14NMethodParameterSpec;
 import javax.xml.crypto.dsig.spec.TransformParameterSpec;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerException;
@@ -235,4 +233,5 @@ public class SignatureUtil {
         InputStream inputStream = SignatureUtil.class.getResourceAsStream(docResourcePath);
         return org.apache.commons.io.IOUtils.toString(inputStream, "UTF-8");
     }
+
 }
diff --git a/smp-server-library/src/test/java/eu/europa/ec/cipa/smp/server/util/CommonUtil.java b/smp-server-library/src/test/java/eu/europa/ec/cipa/smp/server/util/CommonUtil.java
deleted file mode 100644
index 4e2c3f6ac89e61ac143b050cac20ddb2160cadbd..0000000000000000000000000000000000000000
--- a/smp-server-library/src/test/java/eu/europa/ec/cipa/smp/server/util/CommonUtil.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright 2017 European Commission | CEF eDelivery
- *
- * Licensed under the EUPL, Version 1.2 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- *
- * You may obtain a copy of the Licence attached in file: LICENCE-EUPL-v1.2.pdf
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and limitations under the Licence.
- */
-
-package eu.europa.ec.cipa.smp.server.util;
-
-import org.apache.commons.lang3.StringUtils;
-import org.bouncycastle.asn1.x500.X500Name;
-import org.bouncycastle.asn1.x509.*;
-import org.bouncycastle.cert.X509v3CertificateBuilder;
-import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter;
-import org.bouncycastle.operator.ContentSigner;
-import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;
-
-import java.io.FileInputStream;
-import java.math.BigInteger;
-import java.security.KeyPair;
-import java.security.KeyPairGenerator;
-import java.security.KeyStore;
-import java.security.cert.X509Certificate;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Locale;
-
-/**
- * Created by rodrfla on 29/11/2016.
- */
-public class CommonUtil {
-
-    public static Date convertStringToDate(String dateStr) throws ParseException {
-        SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd");
-        return formatter.parse(dateStr);
-    }
-
-    public static X509Certificate createCertificateForX509(String serialNumber, String issuer, String subject, Date startDate, Date expiryDate) throws Exception {
-        KeyStore keyStore = KeyStore.getInstance("JKS");
-        keyStore.load(new FileInputStream(Thread.currentThread().getContextClassLoader().getResource("keystore.jks").getFile()), "test".toCharArray());
-
-        KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
-        keyGen.initialize(1024);
-        KeyPair key = keyGen.generateKeyPair();
-        X509v3CertificateBuilder certBuilder = new X509v3CertificateBuilder(new X500Name(issuer), new BigInteger(serialNumber, 16), startDate, expiryDate, new X500Name(subject), SubjectPublicKeyInfo.getInstance(key.getPublic().getEncoded()));
-
-        //CRL Distribution Points
-        DistributionPointName distPointOne = new DistributionPointName(new GeneralNames(
-                new GeneralName(GeneralName.uniformResourceIdentifier, Thread.currentThread().getContextClassLoader().getResource("test.crl").toString())));
-
-        DistributionPoint[] distPoints = new DistributionPoint[]{new DistributionPoint(distPointOne, null, null)};
-        certBuilder.addExtension(Extension.cRLDistributionPoints, false, new CRLDistPoint(distPoints));
-
-        ContentSigner sigGen = new JcaContentSignerBuilder("SHA1WithRSAEncryption").setProvider("BC").build(key.getPrivate());
-        return new JcaX509CertificateConverter().setProvider("BC").getCertificate(certBuilder.build(sigGen));
-    }
-
-
-    public static String createHeaderCertificateForBlueCoat() throws Exception {
-        return createHeaderCertificateForBlueCoat(null,false);
-    }
-
-    public static String createHeaderCertificateForBlueCoat(String tSubject, boolean isPolicyParamIncluded) throws Exception {
-        String serial = "123ABCD";
-        // different order for the issuer certificate with extra spaces
-        String issuer = "CN=PEPPOL SERVICE METADATA PUBLISHER TEST CA,  C=DK, O=NATIONAL IT AND TELECOM AGENCY,    OU=FOR TEST PURPOSES ONLY";
-        String subject = "O=DG-DIGIT,C=BE,CN=SMP_123456789";
-        if (!StringUtils.isEmpty(tSubject)) {
-            subject = tSubject;
-        }
-        DateFormat df = new SimpleDateFormat("MMM d hh:mm:ss yyyy zzz", Locale.US);
-        Date validFrom = df.parse("Jun 01 10:37:53 2015 CEST");
-        Date validTo = df.parse("Jun 01 10:37:53 2035 CEST");
-        if (!isPolicyParamIncluded) {
-            return createHeaderCertificateForBlueCoat(serial, issuer, subject, validFrom, validTo);
-        }
-        return createHeaderCertificateForBlueCoatWithPolicyOids(serial, issuer, subject, validFrom, validTo, "&policy_oids=5.0.6.0.4.1.0000.66.99");
-    }
-
-    public static String createHeaderCertificateForBlueCoat(String serialNumber, String issuer, String subject, Date startDate, Date expiryDate) throws Exception {
-        DateFormat df = new SimpleDateFormat("MMM d hh:mm:ss yyyy zzz", Locale.US);
-        return "serial=" + serialNumber + "&subject=" + subject + "&validFrom=" + df.format(startDate) + "&validTo=" + df.format(expiryDate) + "&issuer=" + issuer;
-    }
-
-    public static String createHeaderCertificateForBlueCoatWithPolicyOids(String serialNumber, String issuer, String subject, Date startDate, Date expiryDate, String policy_oids) throws Exception {
-        return createHeaderCertificateForBlueCoat(serialNumber, issuer, subject, startDate, expiryDate) + policy_oids;
-    }
-}
diff --git a/smp-server-library/src/test/java/eu/europa/ec/cipa/smp/server/util/DefaultHttpHeader.java b/smp-server-library/src/test/java/eu/europa/ec/cipa/smp/server/util/DefaultHttpHeader.java
deleted file mode 100644
index 3d024f4a1d62140f1326ee0e0351646720625f9b..0000000000000000000000000000000000000000
--- a/smp-server-library/src/test/java/eu/europa/ec/cipa/smp/server/util/DefaultHttpHeader.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright 2017 European Commission | CEF eDelivery
- *
- * Licensed under the EUPL, Version 1.2 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- *
- * You may obtain a copy of the Licence attached in file: LICENCE-EUPL-v1.2.pdf
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and limitations under the Licence.
- */
-
-package eu.europa.ec.cipa.smp.server.util;
-
-import javax.ws.rs.core.Cookie;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import java.util.*;
-/**
- * Created by rodrfla on 13/01/2017.
- */
-public class DefaultHttpHeader implements HttpHeaders {
-
-    private Map<String, List<String>> headerMap;
-    private List<String> requestHeaders;
-
-    {
-        headerMap = new HashMap<>();
-        requestHeaders = new ArrayList<>();
-    }
-
-    public void addRequestHeader(String headerParameter, List<String> values) {
-        headerMap.put(headerParameter, values);
-    }
-
-    @Override
-    public List<String> getRequestHeader(String headerParameter) {
-        return headerMap.get(headerParameter);
-    }
-
-    @Override
-    public String getHeaderString(String name) {
-        return null;
-    }
-
-    @Override
-    public MultivaluedMap<String, String> getRequestHeaders() {
-        return null;
-    }
-
-    @Override
-    public List<MediaType> getAcceptableMediaTypes() {
-        return null;
-    }
-
-    @Override
-    public List<Locale> getAcceptableLanguages() {
-        return null;
-    }
-
-    @Override
-    public MediaType getMediaType() {
-        return null;
-    }
-
-    @Override
-    public Locale getLanguage() {
-        return null;
-    }
-
-    @Override
-    public Map<String, Cookie> getCookies() {
-        return null;
-    }
-
-    @Override
-    public Date getDate() {
-        return null;
-    }
-
-    @Override
-    public int getLength() {
-        return 0;
-    }
-}
diff --git a/smp-server-library/src/test/java/eu/europa/ec/cipa/smp/server/util/IdentifierUtilsTest.java b/smp-server-library/src/test/java/eu/europa/ec/cipa/smp/server/util/IdentifierUtilsTest.java
deleted file mode 100644
index 90ac8130c839fb9a1c9488dd503c13c8fc6871b5..0000000000000000000000000000000000000000
--- a/smp-server-library/src/test/java/eu/europa/ec/cipa/smp/server/util/IdentifierUtilsTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2017 European Commission | CEF eDelivery
- *
- * Licensed under the EUPL, Version 1.2 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- *
- * You may obtain a copy of the Licence attached in file: LICENCE-EUPL-v1.2.pdf
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and limitations under the Licence.
- */
-package eu.europa.ec.cipa.smp.server.util;
-
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-import eu.europa.ec.edelivery.smp.data.model.CommonColumnsLengths;
-import org.junit.Test;
-import org.oasis_open.docs.bdxr.ns.smp._2016._05.DocumentIdentifier;
-import org.oasis_open.docs.bdxr.ns.smp._2016._05.ParticipantIdentifierType;
-
-import static org.junit.Assert.*;
-
-/**
- * Test class for class {@link IdentifierUtils}.
- *
- * @author PEPPOL.AT, BRZ, Philip Helger
- */
-public final class IdentifierUtilsTest {
-
-  @Test
-  public void testAreIdentifiersEqualPariticpantIdentifier () {
-    final ParticipantIdentifierType aPI1 = new ParticipantIdentifierType(null, "0088:123abc");
-
-    final ParticipantIdentifierType aPI3a = new ParticipantIdentifierType("iso6523-actorid-upis","0088:123456");
-    final ParticipantIdentifierType aPI3b = new ParticipantIdentifierType ("my-actorid-scheme", "0088:12345");
-    assertTrue (IdentifierUtils.areIdentifiersEqual (aPI1, aPI1));
-    assertFalse (IdentifierUtils.areIdentifiersEqual (aPI1, aPI3a));
-    assertFalse (IdentifierUtils.areIdentifiersEqual (aPI1, aPI3b));
-    assertFalse (IdentifierUtils.areIdentifiersEqual (aPI3a, aPI3b));
-
-    try {
-      IdentifierUtils.areIdentifiersEqual (aPI1, null);
-      fail ("null parameter not allowed");
-    }
-    catch (final IllegalArgumentException ex) {
-      // expected
-    }
-
-    try {
-      IdentifierUtils.areIdentifiersEqual (null, aPI1);
-      fail ("null parameter not allowed");
-    }
-    catch (final IllegalArgumentException ex) {
-      // expected
-    }
-  }
-
-}
diff --git a/smp-server-library/src/test/java/eu/europa/ec/cipa/smp/server/util/SMPDBUtilsTest.java b/smp-server-library/src/test/java/eu/europa/ec/cipa/smp/server/util/SMPDBUtilsTest.java
deleted file mode 100644
index fcbb30287647feca24e223eb6eae61ec3e574253..0000000000000000000000000000000000000000
--- a/smp-server-library/src/test/java/eu/europa/ec/cipa/smp/server/util/SMPDBUtilsTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2017 European Commission | CEF eDelivery
- *
- * Licensed under the EUPL, Version 1.2 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- *
- * You may obtain a copy of the Licence attached in file: LICENCE-EUPL-v1.2.pdf
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and limitations under the Licence.
- */
-package eu.europa.ec.cipa.smp.server.util;
-
-import org.junit.Test;
-import org.oasis_open.docs.bdxr.ns.smp._2016._05.ExtensionType;
-import org.w3c.dom.Element;
-
-import java.util.Arrays;
-
-import static org.junit.Assert.*;
-
-/**
- * @author PEPPOL.AT, BRZ, Philip Helger
- */
-public class SMPDBUtilsTest {/*
-  @Test
-  public void getRFC1421CompliantStringWithoutCarriageReturnCharacters () {
-    assertNull (SMPDBUtils.getRFC1421CompliantStringWithoutCarriageReturnCharacters(null));
-    assertEquals ("", SMPDBUtils.getRFC1421CompliantStringWithoutCarriageReturnCharacters(""));
-
-    // for up to 64 chars it makes no difference
-    for (int i = 0; i <= 64; ++i) {
-      final char [] aChars = new char [i];
-      Arrays.fill (aChars, 'a');
-      final String sText = new String (aChars);
-      assertEquals (sText, SMPDBUtils.getRFC1421CompliantStringWithoutCarriageReturnCharacters(sText));
-    }
-
-    final String sLong = "123456789012345678901234567890123456789012345678901234567890abcd"
-                         + "123456789012345678901234567890123456789012345678901234567890abcd"
-                         + "xyz";
-    final String sFormatted = SMPDBUtils.getRFC1421CompliantStringWithoutCarriageReturnCharacters(sLong);
-    assertEquals ("123456789012345678901234567890123456789012345678901234567890abcd\n"
-                  + "123456789012345678901234567890123456789012345678901234567890abcd\n"
-                  + "xyz", sFormatted);
-  }
-
-  @Test
-  public void testConvertFromString () {
-    // Use elements
-    final String sXML = "<any xmlns=\"urn:foo\"><child>text1</child><child2 /></any>";
-    final ExtensionType aExtension = SMPDBUtils.getAsExtensionSafe(sXML);
-    assertNotNull (aExtension);
-    assertNotNull (aExtension.getAny ());
-    assertTrue (aExtension.getAny () instanceof Element);
-
-    assertNull (SMPDBUtils.getAsExtensionSafe((String) null));
-    assertNull (SMPDBUtils.getAsExtensionSafe(""));
-
-    // Convert back to String
-    final String sXML2 = SMPDBUtils.convert(aExtension);
-    assertEquals (sXML, sXML2);
-
-    // Cannot convert non-element
-    ExtensionType extension = SMPDBUtils.getAsExtensionSafe("Plain text");
-    assertNull(extension);
-  }
-  */
-}
diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/config/PropertiesTestConfig.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/config/PropertiesTestConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..53668e57b3eb4a694566e11566f77749b4a8a5b5
--- /dev/null
+++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/config/PropertiesTestConfig.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2018 European Commission | CEF eDelivery
+ *
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ *
+ * You may obtain a copy of the Licence attached in file: LICENCE-EUPL-v1.2.pdf
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and limitations under the Licence.
+ */
+
+package eu.europa.ec.edelivery.smp.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.context.annotation.PropertySources;
+import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
+
+import java.util.Properties;
+
+/**
+ * Created by gutowpa on 11/01/2018.
+ */
+@Configuration
+@PropertySource("classpath:config.properties")
+public class PropertiesTestConfig {
+
+    private final static String SIGNING_KEYSTORE_PATH = Thread.currentThread().getContextClassLoader().getResource("signature_keys.jks").getFile();
+
+    @Bean
+    public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
+        PropertySourcesPlaceholderConfigurer propertiesConfig = new PropertySourcesPlaceholderConfigurer();
+
+        Properties localProps = new Properties();
+        localProps.setProperty("xmldsig.keystore.classpath", SIGNING_KEYSTORE_PATH);
+        propertiesConfig.setProperties(localProps);
+        propertiesConfig.setLocalOverride(true);
+
+        return propertiesConfig;
+    }
+}
diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/config/SmpServicesTestConfig.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/config/SmpServicesTestConfig.java
index 0f9dbbced458a10a1137456cf089196abf632cf4..0f96f2a58d73151f2db370d6336f67dc189dda1f 100644
--- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/config/SmpServicesTestConfig.java
+++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/config/SmpServicesTestConfig.java
@@ -14,10 +14,7 @@
 package eu.europa.ec.edelivery.smp.config;
 
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.PropertySource;
+import org.springframework.context.annotation.*;
 import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
 import org.springframework.jdbc.datasource.DriverManagerDataSource;
 import org.springframework.orm.jpa.JpaTransactionManager;
@@ -27,6 +24,7 @@ import org.springframework.transaction.PlatformTransactionManager;
 
 import javax.persistence.EntityManagerFactory;
 import javax.sql.DataSource;
+import java.util.Properties;
 
 /**
  * Created by gutowpa on 21/09/2017.
@@ -38,7 +36,7 @@ import javax.sql.DataSource;
         "eu.europa.ec.edelivery.smp.sml",
         "eu.europa.ec.edelivery.smp.conversion",
         "eu.europa.ec.cipa.smp.server.util"})
-@PropertySource(value = "classpath:config.properties")
+@Import(PropertiesTestConfig.class)
 public class SmpServicesTestConfig {
 
     @Value("${jdbc.driver}")
@@ -53,11 +51,6 @@ public class SmpServicesTestConfig {
     @Value("${jdbc.url}")
     private String url;
 
-    @Bean
-    public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
-        return new PropertySourcesPlaceholderConfigurer();
-    }
-
     @Bean
     public DataSource dataSource() {
         DriverManagerDataSource driverManagerDataSource = new DriverManagerDataSource();
diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ServiceMetadataIntegrationTest.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ServiceMetadataIntegrationTest.java
index f12eea017f060c380e39e9a57db97debaa0cbc26..5e38292f4d21a46e27bb9b6397c0e73ef51742e0 100644
--- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ServiceMetadataIntegrationTest.java
+++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ServiceMetadataIntegrationTest.java
@@ -159,14 +159,16 @@ public class ServiceMetadataIntegrationTest {
         EndpointType endpoint = newServiceMetadata.getServiceInformation().getProcessList().getProcesses().get(0).getServiceEndpointList().getEndpoints().get(0);
         endpoint.setServiceDescription("New Description");
         String newServiceMetadataXml = marshall(newServiceMetadata);
+
         serviceMetadataService.saveServiceMetadata(SERVICE_GROUP_ID, DOC_ID, newServiceMetadataXml);
 
         //when
-        Document resultServiceMetadataDoc = serviceMetadataService.getServiceMetadataDocument(SERVICE_GROUP_ID, DOC_ID);
 
+        Document resultServiceMetadataDoc = serviceMetadataService.getServiceMetadataDocument(SERVICE_GROUP_ID, DOC_ID);
         //then
         String newDescription = resultServiceMetadataDoc.getElementsByTagName("ServiceDescription").item(0).getTextContent();
         assertEquals("New Description", newDescription);
+
     }
 
     @Test
diff --git a/smp-server-library/src/test/java/eu/europa/ec/cipa/smp/server/security/SignerTest.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ServiceMetadataSignerTest.java
similarity index 70%
rename from smp-server-library/src/test/java/eu/europa/ec/cipa/smp/server/security/SignerTest.java
rename to smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ServiceMetadataSignerTest.java
index 8e15d06e2526f8a2a47d4554ef74aa76ff7741fc..130f171f196c90bb93f2505bacded1d0a78194aa 100644
--- a/smp-server-library/src/test/java/eu/europa/ec/cipa/smp/server/security/SignerTest.java
+++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ServiceMetadataSignerTest.java
@@ -1,7 +1,7 @@
 /*
- * Copyright 2017 European Commission | CEF eDelivery
+ * Copyright 2018 European Commission | CEF eDelivery
  *
- * Licensed under the EUPL, Version 1.2 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "Licence");
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "Licence");
  * You may not use this work except in compliance with the Licence.
  *
  * You may obtain a copy of the Licence attached in file: LICENCE-EUPL-v1.2.pdf
@@ -11,25 +11,39 @@
  * See the Licence for the specific language governing permissions and limitations under the Licence.
  */
 
-package eu.europa.ec.cipa.smp.server.security;
+package eu.europa.ec.edelivery.smp.services;
 
+import eu.europa.ec.cipa.smp.server.security.SignatureUtil;
+import eu.europa.ec.edelivery.smp.config.PropertiesTestConfig;
+import eu.europa.ec.edelivery.smp.config.SmpServicesTestConfig;
+import eu.europa.ec.edelivery.smp.services.ServiceMetadataSigner;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Import;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
-import java.security.cert.X509Certificate;
-
 import static eu.europa.ec.cipa.smp.server.util.XmlTestUtils.loadDocument;
 
 /**
  * Created by rodrfla on 20/02/2017.
  */
-public class SignerTest {
+
+@RunWith(SpringRunner.class)
+@ContextConfiguration(classes = SmpServicesTestConfig.class)
+public class ServiceMetadataSignerTest {
+
+    @Autowired
+    private ServiceMetadataSigner signer;
 
     private Document loadAndSignDocumentForDefault() throws Exception {
         Document documentToSign = loadDocument("/input/SignedServiceMetadata_withoutSignature.xml");
-        Signer signatureSigner = new Signer(SignatureUtil.loadPrivateKey(), (X509Certificate) SignatureUtil.loadCertificate());
-        signatureSigner.signXML(documentToSign.getDocumentElement());
+        signer.sign(documentToSign);
 
         return documentToSign;
     }
@@ -76,4 +90,5 @@ public class SignerTest {
 
         SignatureUtil.validateSignature(adminSignature);
     }
+
 }
diff --git a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/config/DatabaseConfig.java b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/config/DatabaseConfig.java
index 3cc3d974f0bb552d3bb90503e8600d7cc2a5bba7..fc4edd576eec08ed683c1fe0688bc3373409e226 100644
--- a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/config/DatabaseConfig.java
+++ b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/config/DatabaseConfig.java
@@ -33,10 +33,7 @@ import javax.sql.DataSource;
 
 @Configuration
 @EnableTransactionManagement
-@ComponentScan(basePackages = {
-        "eu.europa.ec.edelivery.smp.data.dao",
-        "eu.europa.ec.cipa.smp.server.services",
-        "eu.europa.ec.cipa.smp.server.hook"})
+@ComponentScan(basePackages = {"eu.europa.ec.edelivery.smp.data.dao"})
 public class DatabaseConfig {
 
     @Value("${jdbc.driver}")
diff --git a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/config/SmpAppConfig.java b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/config/SmpAppConfig.java
index 3676f4613049e19b8cc86cd5988e2ca6ac1aeda8..694e8c95ed83bd99868641ff28169da2801253d4 100644
--- a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/config/SmpAppConfig.java
+++ b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/config/SmpAppConfig.java
@@ -25,11 +25,9 @@ import org.springframework.context.annotation.Import;
 @ComponentScan(basePackages = {
         "eu.europa.ec.edelivery.smp.validation",
         "eu.europa.ec.edelivery.smp.services",
-        "eu.europa.ec.edelivery.smp.data.dao",
-        "eu.europa.ec.cipa.smp.server.hook",
-        "eu.europa.ec.edelivery.smp.conversion",
-        "eu.europa.ec.cipa.smp.server.util"})
-@Import({PropertiesConfig.class, DatabaseConfig.class})
+        "eu.europa.ec.edelivery.smp.sml",
+        "eu.europa.ec.edelivery.smp.conversion"})
+@Import(DatabaseConfig.class)
 public class SmpAppConfig {
 
 }
diff --git a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/config/SmpWebAppConfig.java b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/config/SmpWebAppConfig.java
index 0d41765457e21c72d04bbc056bd51fdfaf2354cf..4d1ab0ef7770083f9ce7ed493fefa51fe4271591 100644
--- a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/config/SmpWebAppConfig.java
+++ b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/config/SmpWebAppConfig.java
@@ -13,7 +13,6 @@
 
 package eu.europa.ec.edelivery.smp.config;
 
-import eu.europa.ec.cipa.smp.server.util.SignatureFilter;
 import eu.europa.ec.edelivery.smp.error.ErrorMappingControllerAdvice;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.Configuration;
diff --git a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/validation/ServiceGroupValidator.java b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/validation/ServiceGroupValidator.java
index 1b6e136611505b546f2a70483048a1f6e3217336..3b0e28d7a6b20a38d41f0fd43b41446c8406cea2 100644
--- a/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/validation/ServiceGroupValidator.java
+++ b/smp-webapp/src/main/java/eu/europa/ec/edelivery/smp/validation/ServiceGroupValidator.java
@@ -13,7 +13,6 @@
 
 package eu.europa.ec.edelivery.smp.validation;
 
-import eu.europa.ec.cipa.smp.server.util.IdentifierUtils;
 import eu.europa.ec.edelivery.smp.error.exceptions.BadRequestException;
 import eu.europa.ec.smp.api.Identifiers;
 import org.oasis_open.docs.bdxr.ns.smp._2016._05.ParticipantIdentifierType;
@@ -46,8 +45,8 @@ public class ServiceGroupValidator {
 
     public void validate(String serviceGroupId, ServiceGroup serviceGroup) {
 
-        final ParticipantIdentifierType aServiceGroupID = Identifiers.asParticipantId(serviceGroupId);
-        if (!IdentifierUtils.areIdentifiersEqual(aServiceGroupID, serviceGroup.getParticipantIdentifier())) {
+        final ParticipantIdentifierType participantId = Identifiers.asParticipantId(serviceGroupId);
+        if (!participantId.equals(serviceGroup.getParticipantIdentifier())) {
             // Business identifier must equal path
             throw new BadRequestException(WRONG_FIELD, "Service Group Ids don't match between URL parameter and XML body");
         }
diff --git a/smp-webapp/src/main/webapp/WEB-INF/web.xml b/smp-webapp/src/main/webapp/WEB-INF/web.xml
index c8bc20c50be88e607e05a99707fafcf7235c3e45..4f2375f2880c40ad267ef17828dfcf90045f0457 100644
--- a/smp-webapp/src/main/webapp/WEB-INF/web.xml
+++ b/smp-webapp/src/main/webapp/WEB-INF/web.xml
@@ -54,7 +54,8 @@
         <param-name>contextConfigLocation</param-name>
         <param-value>
             eu.europa.ec.edelivery.smp.config.SpringSecurityConfig;
-            eu.europa.ec.edelivery.smp.config.SmpAppConfig
+            eu.europa.ec.edelivery.smp.config.SmpAppConfig;
+            eu.europa.ec.edelivery.smp.config.PropertiesConfig
         </param-value>
     </context-param>
     <filter>
diff --git a/smp-webapp/src/test/java/eu/europa/ec/cipa/smp/server/security/SecurityConfigurationTest.java b/smp-webapp/src/test/java/eu/europa/ec/cipa/smp/server/security/SecurityConfigurationTest.java
index 6c5e4ecfd88849bf95c6aeba196f30af23a7f086..dbbd605c1e8e8a0444c025c2817cbb68b38ff193 100644
--- a/smp-webapp/src/test/java/eu/europa/ec/cipa/smp/server/security/SecurityConfigurationTest.java
+++ b/smp-webapp/src/test/java/eu/europa/ec/cipa/smp/server/security/SecurityConfigurationTest.java
@@ -13,10 +13,7 @@
 
 package eu.europa.ec.cipa.smp.server.security;
 
-import eu.europa.ec.edelivery.smp.config.PropertiesConfig;
-import eu.europa.ec.edelivery.smp.config.DatabaseConfig;
-import eu.europa.ec.edelivery.smp.config.SpringSecurityConfig;
-import eu.europa.ec.edelivery.smp.config.SpringSecurityTestConfig;
+import eu.europa.ec.edelivery.smp.config.*;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -43,7 +40,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
  */
 @RunWith(SpringJUnit4ClassRunner.class)
 @ContextConfiguration(classes = {
-        PropertiesConfig.class,
+        PropertiesTestConfig.class,
         DatabaseConfig.class,
         SpringSecurityConfig.class,
         SpringSecurityTestConfig.class
diff --git a/smp-webapp/src/test/java/eu/europa/ec/cipa/smp/server/security/SignatureValidatorTest.java b/smp-webapp/src/test/java/eu/europa/ec/cipa/smp/server/security/SignatureValidatorTest.java
index c6a7687e764f8acc9e97f21aaa739ef5fa27b1cf..d87daaab8009992522a862bf634187b3aea634bf 100644
--- a/smp-webapp/src/test/java/eu/europa/ec/cipa/smp/server/security/SignatureValidatorTest.java
+++ b/smp-webapp/src/test/java/eu/europa/ec/cipa/smp/server/security/SignatureValidatorTest.java
@@ -15,6 +15,7 @@ package eu.europa.ec.cipa.smp.server.security;
 
 
 import eu.europa.ec.edelivery.security.PreAuthenticatedCertificatePrincipal;
+import eu.europa.ec.edelivery.smp.config.PropertiesTestConfig;
 import eu.europa.ec.edelivery.smp.config.SmpAppConfig;
 import eu.europa.ec.edelivery.smp.config.SmpWebAppConfig;
 import eu.europa.ec.edelivery.smp.config.SpringSecurityConfig;
@@ -64,6 +65,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
 
 @RunWith(SpringJUnit4ClassRunner.class)
 @ContextConfiguration(classes = {
+        PropertiesTestConfig.class,
         SmpAppConfig.class,
         SmpWebAppConfig.class,
         SpringSecurityConfig.class
diff --git a/smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/config/PropertiesTestConfig.java b/smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/config/PropertiesTestConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..a7930846365c3d44778595878bf52d5529866e1b
--- /dev/null
+++ b/smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/config/PropertiesTestConfig.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2018 European Commission | CEF eDelivery
+ *
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ *
+ * You may obtain a copy of the Licence attached in file: LICENCE-EUPL-v1.2.pdf
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and limitations under the Licence.
+ */
+
+package eu.europa.ec.edelivery.smp.config;
+
+import org.springframework.context.annotation.*;
+import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
+
+import java.util.Properties;
+
+/**
+ * Created by gutowpa on 11/01/2018.
+ */
+@Configuration
+@PropertySources({
+        @PropertySource(value = "classpath:config.properties", ignoreResourceNotFound = true)
+})
+public class PropertiesTestConfig {
+
+    private final static String SIGNING_KEYSTORE_PATH = Thread.currentThread().getContextClassLoader().getResource("signature_keys.jks").getFile();
+
+    @Bean
+    public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
+        PropertySourcesPlaceholderConfigurer propertiesConfig = new PropertySourcesPlaceholderConfigurer();
+
+        Properties localProps = new Properties();
+        localProps.setProperty("xmldsig.keystore.classpath", SIGNING_KEYSTORE_PATH);
+        propertiesConfig.setProperties(localProps);
+        propertiesConfig.setLocalOverride(true);
+
+        return propertiesConfig;
+    }
+}
diff --git a/smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/controllers/ServiceGroupControllerTest.java b/smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/controllers/ServiceGroupControllerTest.java
index 4d551826272d0f52d0c8d05029e65023bb35c483..af347007122a81e1407160d5e005b7b548a86aaa 100644
--- a/smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/controllers/ServiceGroupControllerTest.java
+++ b/smp-webapp/src/test/java/eu/europa/ec/edelivery/smp/controllers/ServiceGroupControllerTest.java
@@ -13,6 +13,7 @@
 
 package eu.europa.ec.edelivery.smp.controllers;
 
+import eu.europa.ec.edelivery.smp.config.PropertiesTestConfig;
 import eu.europa.ec.edelivery.smp.config.SmpAppConfig;
 import eu.europa.ec.edelivery.smp.config.SmpWebAppConfig;
 import eu.europa.ec.edelivery.smp.config.SpringSecurityConfig;
@@ -50,6 +51,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
  */
 @RunWith(SpringJUnit4ClassRunner.class)
 @ContextConfiguration(classes = {
+        PropertiesTestConfig.class,
         SmpAppConfig.class,
         SmpWebAppConfig.class,
         SpringSecurityConfig.class})