private Properties createCryptoProperties()

in plugins/core/src/main/java/org/apache/cxf/fediz/core/config/FedizContext.java [329:366]


    private Properties createCryptoProperties(TrustManagersType tm) {
        String trustStoreFile = null;
        KeyStoreType ks = tm.getKeyStore();
        String trustStorePw = ks.getPassword();
        if (ks.getFile() != null && !ks.getFile().isEmpty()) {
            trustStoreFile = ks.getFile();
        } else if (ks.getResource() != null && !ks.getResource().isEmpty()) {
            URL resource = Loader.getResource(ks.getResource());
            if (resource != null) {
                // WSS4J will re-load the resource anyway
                trustStoreFile = ks.getResource();
            }
        }

        if (trustStoreFile == null) {
            throw new IllegalStateException("No certificate store configured");
        }
        File f = new File(trustStoreFile);
        if (!f.exists() && getRelativePath() != null && !getRelativePath().isEmpty()) {
            trustStoreFile = getRelativePath().concat(File.separator + trustStoreFile);
        }

        if (trustStoreFile == null || trustStoreFile.isEmpty()) {
            throw new IllegalConfigurationException("truststoreFile not configured");
        }
        if (trustStorePw == null || trustStorePw.isEmpty()) {
            throw new IllegalConfigurationException("trustStorePw not configured");
        }
        Properties p = new Properties();
        p.put("org.apache.ws.security.crypto.provider",
                "org.apache.ws.security.components.crypto.Merlin");
        p.put("org.apache.ws.security.crypto.merlin.keystore.type", "jks");
        p.put("org.apache.ws.security.crypto.merlin.keystore.password",
              trustStorePw);
        p.put("org.apache.ws.security.crypto.merlin.keystore.file",
              trustStoreFile);
        return p;
    }