From: Remigiusz Janeczek Date: Mon, 10 Aug 2020 09:39:43 +0000 (+0200) Subject: Add TruststoreFile provider X-Git-Tag: 2.0.0~5^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=eddd3bd7b3d7fbb7cc052eebf3059589f1715233;p=oom%2Fplatform%2Fcert-service.git Add TruststoreFile provider Move certification.file classes to certification.path package Issue-ID: DCAEGEN2-2253 Signed-off-by: Remigiusz Janeczek Change-Id: I3098ac443b940031506732216f2bedffa3143adb --- diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/TrustStoreMerger.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/TrustStoreMerger.java index 3a3b9b6e..98c67ba8 100644 --- a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/TrustStoreMerger.java +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/TrustStoreMerger.java @@ -21,11 +21,18 @@ package org.onap.oom.truststoremerger; import org.onap.oom.truststoremerger.api.ExitStatus; import org.onap.oom.truststoremerger.api.ExitableException; -import org.onap.oom.truststoremerger.certification.file.EnvProvider; -import org.onap.oom.truststoremerger.certification.file.TruststoresPathsProvider; +import org.onap.oom.truststoremerger.certification.file.TruststoreFile; +import org.onap.oom.truststoremerger.certification.file.provider.FileManager; +import org.onap.oom.truststoremerger.certification.file.provider.PasswordReader; +import org.onap.oom.truststoremerger.certification.file.provider.TruststoreFileFactory; +import org.onap.oom.truststoremerger.certification.file.provider.TruststoreFilesListProvider; +import org.onap.oom.truststoremerger.certification.path.EnvProvider; +import org.onap.oom.truststoremerger.certification.path.TruststoresPathsProvider; import org.onap.oom.truststoremerger.configuration.MergerConfiguration; import org.onap.oom.truststoremerger.configuration.MergerConfigurationFactory; -import org.onap.oom.truststoremerger.certification.file.PathValidator; +import org.onap.oom.truststoremerger.certification.path.PathValidator; + +import java.util.List; class TrustStoreMerger { @@ -46,6 +53,7 @@ class TrustStoreMerger { private void mergeTruststores() throws ExitableException { MergerConfiguration configuration = loadConfiguration(); + List truststoreFilesList = getTruststoreFilesList(configuration); } private MergerConfiguration loadConfiguration() throws ExitableException { @@ -53,4 +61,14 @@ class TrustStoreMerger { MergerConfigurationFactory factory = new MergerConfigurationFactory(truststoresPathsProvider); return factory.createConfiguration(); } + + private List getTruststoreFilesList(MergerConfiguration configuration) throws ExitableException { + TruststoreFileFactory truststoreFileFactory = new TruststoreFileFactory(new FileManager(), new PasswordReader()); + TruststoreFilesListProvider truststoreFilesListProvider = new TruststoreFilesListProvider(truststoreFileFactory); + return truststoreFilesListProvider + .getTruststoreFilesList( + configuration.getTruststoreFilePaths(), + configuration.getTruststoreFilePasswordPaths() + ); + } } diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/api/ExitStatus.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/api/ExitStatus.java index ae145f7e..d0c3b2f0 100644 --- a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/api/ExitStatus.java +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/api/ExitStatus.java @@ -23,7 +23,9 @@ public enum ExitStatus { SUCCESS(0, "Success"), TRUSTSTORES_PATHS_PROVIDER_EXCEPTION(1, "Invalid paths in environment variables"), - MERGER_CONFIGURATION_EXCEPTION(2, "Invalid merger configuration"); + MERGER_CONFIGURATION_EXCEPTION(2, "Invalid merger configuration"), + TRUSTSTORE_FILE_FACTORY_EXCEPTION(3, "Invalid truststore file-password pair"), + PASSWORD_READER_EXCEPTION(4, "Cannot read password from file"); private final int value; private final String message; diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/JksTruststore.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/JksTruststore.java new file mode 100644 index 00000000..b977daee --- /dev/null +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/JksTruststore.java @@ -0,0 +1,37 @@ +/*============LICENSE_START======================================================= + * oom-truststore-merger + * ================================================================================ + * Copyright (C) 2020 Nokia. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.oom.truststoremerger.certification.file; + +import java.io.File; +import java.security.cert.Certificate; +import java.util.Collections; +import java.util.List; + +public class JksTruststore extends TruststoreFileWithPassword { + + public JksTruststore(File truststoreFile, String password) { + super(truststoreFile, password); + } + + @Override + public List getCertificates() { + return Collections.emptyList(); + } +} diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/P12Truststore.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/P12Truststore.java new file mode 100644 index 00000000..8527cce5 --- /dev/null +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/P12Truststore.java @@ -0,0 +1,38 @@ +/*============LICENSE_START======================================================= + * oom-truststore-merger + * ================================================================================ + * Copyright (C) 2020 Nokia. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.oom.truststoremerger.certification.file; + +import java.io.File; +import java.security.cert.Certificate; +import java.util.Collections; +import java.util.List; + +public class P12Truststore extends TruststoreFileWithPassword { + + public P12Truststore(File truststoreFile, String password) { + super(truststoreFile, password); + } + + @Override + public List getCertificates() { + return Collections.emptyList(); + } + +} diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/PemTruststore.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/PemTruststore.java new file mode 100644 index 00000000..ca2ac85d --- /dev/null +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/PemTruststore.java @@ -0,0 +1,37 @@ +/*============LICENSE_START======================================================= + * oom-truststore-merger + * ================================================================================ + * Copyright (C) 2020 Nokia. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.oom.truststoremerger.certification.file; + +import java.io.File; +import java.security.cert.Certificate; +import java.util.Collections; +import java.util.List; + +public class PemTruststore extends TruststoreFile { + + public PemTruststore(File truststoreFile) { + super(truststoreFile); + } + + @Override + public List getCertificates() { + return Collections.emptyList(); + } +} diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/TruststoreFile.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/TruststoreFile.java new file mode 100644 index 00000000..88b1b5a8 --- /dev/null +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/TruststoreFile.java @@ -0,0 +1,38 @@ +/*============LICENSE_START======================================================= + * oom-truststore-merger + * ================================================================================ + * Copyright (C) 2020 Nokia. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.oom.truststoremerger.certification.file; + +import java.io.File; +import java.security.cert.Certificate; +import java.util.List; + +public abstract class TruststoreFile { + private File truststoreFile; + + TruststoreFile(File truststoreFile) { + this.truststoreFile = truststoreFile; + } + + public abstract List getCertificates(); + + public File getTruststoreFile() { + return truststoreFile; + }; +} diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/TruststoreFileWithPassword.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/TruststoreFileWithPassword.java new file mode 100644 index 00000000..484f2d4f --- /dev/null +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/TruststoreFileWithPassword.java @@ -0,0 +1,35 @@ +/*============LICENSE_START======================================================= + * oom-truststore-merger + * ================================================================================ + * Copyright (C) 2020 Nokia. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.oom.truststoremerger.certification.file; + +import java.io.File; + +public abstract class TruststoreFileWithPassword extends TruststoreFile { + private String password; + + TruststoreFileWithPassword(File truststoreFile, String password) { + super(truststoreFile); + this.password = password; + } + + public String getPassword(){ + return password; + }; +} diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/provider/FileManager.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/provider/FileManager.java new file mode 100644 index 00000000..901c13ab --- /dev/null +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/provider/FileManager.java @@ -0,0 +1,39 @@ +/*============LICENSE_START======================================================= + * oom-truststore-merger + * ================================================================================ + * Copyright (C) 2020 Nokia. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.oom.truststoremerger.certification.file.provider; + +import java.io.File; + +public class FileManager { + private static final int NOT_FOUND_INDEX=-1; + + String getExtension(File file) { + int extStartIndex = file.getName().lastIndexOf("."); + if (extStartIndex == NOT_FOUND_INDEX) { + return ""; + } + return file.getName().substring(extStartIndex); + } + + boolean checkIfFileExists(File file){ + return file.exists(); + } + +} diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/provider/PasswordReader.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/provider/PasswordReader.java new file mode 100644 index 00000000..db42f3bd --- /dev/null +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/provider/PasswordReader.java @@ -0,0 +1,36 @@ +/*============LICENSE_START======================================================= + * oom-truststore-merger + * ================================================================================ + * Copyright (C) 2020 Nokia. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.oom.truststoremerger.certification.file.provider; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; + +public class PasswordReader { + private static final String COULD_NOT_READ_PASSWORD_FROM_FILE_MSG_TEMPLATE = "Could not read password from file: %s"; + + String readPassword(File file) throws PasswordReaderException { + try { + return Files.readString(file.toPath()); + } catch (IOException e) { + throw new PasswordReaderException(String.format(COULD_NOT_READ_PASSWORD_FROM_FILE_MSG_TEMPLATE, file)); + } + } +} diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/provider/PasswordReaderException.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/provider/PasswordReaderException.java new file mode 100644 index 00000000..2928f0c5 --- /dev/null +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/provider/PasswordReaderException.java @@ -0,0 +1,29 @@ +/*============LICENSE_START======================================================= + * oom-truststore-merger + * ================================================================================ + * Copyright (C) 2020 Nokia. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.oom.truststoremerger.certification.file.provider; + +import org.onap.oom.truststoremerger.api.ExitStatus; +import org.onap.oom.truststoremerger.api.ExitableException; + +class PasswordReaderException extends ExitableException { + PasswordReaderException(String message) { + super(message, ExitStatus.PASSWORD_READER_EXCEPTION); + } +} diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/provider/TruststoreFileFactory.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/provider/TruststoreFileFactory.java new file mode 100644 index 00000000..e63e7c33 --- /dev/null +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/provider/TruststoreFileFactory.java @@ -0,0 +1,84 @@ +/*============LICENSE_START======================================================= + * oom-truststore-merger + * ================================================================================ + * Copyright (C) 2020 Nokia. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.oom.truststoremerger.certification.file.provider; + +import org.onap.oom.truststoremerger.certification.file.JksTruststore; +import org.onap.oom.truststoremerger.certification.file.P12Truststore; +import org.onap.oom.truststoremerger.certification.file.PemTruststore; +import org.onap.oom.truststoremerger.certification.file.TruststoreFile; + +import java.io.File; + +public class TruststoreFileFactory { + + private static final String JKS_EXTENSION = ".jks"; + private static final String P12_EXTENSION = ".p12"; + private static final String PEM_EXTENSION = ".pem"; + private static final String FILE_DOES_NOT_EXIST_MSG_TEMPLATE = "File: %s does not exist"; + private static final String UNKNOWN_TRUSTSTORE_TYPE_MSG_TEMPLATE = "Unknown truststore extension type: %s"; + + private final FileManager fileManager; + private final PasswordReader passwordReader; + + public TruststoreFileFactory(FileManager fileManager, PasswordReader passwordReader) { + this.fileManager = fileManager; + this.passwordReader = passwordReader; + } + + TruststoreFile create(String truststoreFilePath, String truststorePasswordPath) + throws TruststoreFileFactoryException, PasswordReaderException { + File truststoreFile = new File(truststoreFilePath); + if (!fileManager.checkIfFileExists(truststoreFile)) { + throw new TruststoreFileFactoryException(String.format(FILE_DOES_NOT_EXIST_MSG_TEMPLATE, truststoreFile)); + } + return createTypedTruststore(truststoreFile, truststorePasswordPath); + } + + private TruststoreFile createTypedTruststore(File truststoreFile, String truststorePasswordPath) + throws PasswordReaderException, TruststoreFileFactoryException { + String extension = fileManager.getExtension(truststoreFile); + switch (extension) { + case JKS_EXTENSION: + return createJksTruststore(truststoreFile, truststorePasswordPath); + case P12_EXTENSION: + return createP12Truststore(truststoreFile, truststorePasswordPath); + case PEM_EXTENSION: + return createPemTruststore(truststoreFile); + default: + throw new TruststoreFileFactoryException(String.format(UNKNOWN_TRUSTSTORE_TYPE_MSG_TEMPLATE, extension)); + } + } + + private JksTruststore createJksTruststore(File truststoreFile, String truststorePasswordPath) + throws PasswordReaderException { + String password = passwordReader.readPassword(new File(truststorePasswordPath)); + return new JksTruststore(truststoreFile, password); + } + + private P12Truststore createP12Truststore(File truststoreFile, String truststorePasswordPath) + throws PasswordReaderException { + String password = passwordReader.readPassword(new File(truststorePasswordPath)); + return new P12Truststore(truststoreFile, password); + } + + private PemTruststore createPemTruststore(File truststoreFile) { + return new PemTruststore(truststoreFile); + } +} diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/provider/TruststoreFileFactoryException.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/provider/TruststoreFileFactoryException.java new file mode 100644 index 00000000..43342c83 --- /dev/null +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/provider/TruststoreFileFactoryException.java @@ -0,0 +1,30 @@ +/*============LICENSE_START======================================================= + * oom-truststore-merger + * ================================================================================ + * Copyright (C) 2020 Nokia. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.oom.truststoremerger.certification.file.provider; + +import org.onap.oom.truststoremerger.api.ExitStatus; +import org.onap.oom.truststoremerger.api.ExitableException; + +class TruststoreFileFactoryException extends ExitableException { + TruststoreFileFactoryException(String message) { + super(message, ExitStatus.TRUSTSTORE_FILE_FACTORY_EXCEPTION); + } + +} diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/provider/TruststoreFilesListProvider.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/provider/TruststoreFilesListProvider.java new file mode 100644 index 00000000..2f5356d5 --- /dev/null +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/provider/TruststoreFilesListProvider.java @@ -0,0 +1,50 @@ +/*============LICENSE_START======================================================= + * oom-truststore-merger + * ================================================================================ + * Copyright (C) 2020 Nokia. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.oom.truststoremerger.certification.file.provider; + +import org.onap.oom.truststoremerger.certification.file.TruststoreFile; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +public class TruststoreFilesListProvider { + + private final TruststoreFileFactory truststoreFileFactory; + + public TruststoreFilesListProvider(TruststoreFileFactory truststoreFileFactory) { + this.truststoreFileFactory = truststoreFileFactory; + } + + public List getTruststoreFilesList(List truststoreFilePaths, + List truststoreFilePasswordPaths) + throws PasswordReaderException, TruststoreFileFactoryException { + List truststoreFilesList = new ArrayList<>(); + for (int i = 0; i < truststoreFilePaths.size(); i++) { + String truststorePath = truststoreFilePaths.get(i); + String passwordPath = truststoreFilePasswordPaths.get(i); + + TruststoreFile truststoreFile = truststoreFileFactory.create(truststorePath, passwordPath); + truststoreFilesList.add(truststoreFile); + } + + return truststoreFilesList; + } +} diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/EnvProvider.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/path/EnvProvider.java similarity index 95% rename from trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/EnvProvider.java rename to trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/path/EnvProvider.java index f64edc89..4bb763da 100644 --- a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/EnvProvider.java +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/path/EnvProvider.java @@ -17,7 +17,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.oom.truststoremerger.certification.file; +package org.onap.oom.truststoremerger.certification.path; import java.util.Optional; diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/PathValidator.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/path/PathValidator.java similarity index 96% rename from trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/PathValidator.java rename to trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/path/PathValidator.java index 05b80f14..256da490 100644 --- a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/PathValidator.java +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/path/PathValidator.java @@ -17,7 +17,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.oom.truststoremerger.certification.file; +package org.onap.oom.truststoremerger.certification.path; public class PathValidator { diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/TruststoresPathsProvider.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/path/TruststoresPathsProvider.java similarity index 98% rename from trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/TruststoresPathsProvider.java rename to trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/path/TruststoresPathsProvider.java index e23a1add..f8e85d49 100644 --- a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/TruststoresPathsProvider.java +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/path/TruststoresPathsProvider.java @@ -17,7 +17,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.oom.truststoremerger.certification.file; +package org.onap.oom.truststoremerger.certification.path; import static org.onap.oom.truststoremerger.api.ConfigurationEnvs.TRUSTSTORES_ENV; import static org.onap.oom.truststoremerger.api.ConfigurationEnvs.TRUSTSTORES_PASSWORDS_ENV; diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/TruststoresPathsProviderException.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/path/TruststoresPathsProviderException.java similarity index 95% rename from trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/TruststoresPathsProviderException.java rename to trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/path/TruststoresPathsProviderException.java index 5f491c36..1f69fe20 100644 --- a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/file/TruststoresPathsProviderException.java +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/certification/path/TruststoresPathsProviderException.java @@ -17,7 +17,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.oom.truststoremerger.certification.file; +package org.onap.oom.truststoremerger.certification.path; import org.onap.oom.truststoremerger.api.ExitStatus; import org.onap.oom.truststoremerger.api.ExitableException; diff --git a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/MergerConfigurationFactory.java b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/MergerConfigurationFactory.java index fa0b8cde..7a2fdc10 100644 --- a/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/MergerConfigurationFactory.java +++ b/trustStoreMerger/src/main/java/org/onap/oom/truststoremerger/configuration/MergerConfigurationFactory.java @@ -19,8 +19,8 @@ package org.onap.oom.truststoremerger.configuration; -import org.onap.oom.truststoremerger.certification.file.TruststoresPathsProvider; -import org.onap.oom.truststoremerger.certification.file.TruststoresPathsProviderException; +import org.onap.oom.truststoremerger.certification.path.TruststoresPathsProvider; +import org.onap.oom.truststoremerger.certification.path.TruststoresPathsProviderException; import static org.onap.oom.truststoremerger.api.ConfigurationEnvs.TRUSTSTORES_ENV; import static org.onap.oom.truststoremerger.api.ConfigurationEnvs.TRUSTSTORES_PASSWORDS_ENV; diff --git a/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/file/provider/FileManagerTest.java b/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/file/provider/FileManagerTest.java new file mode 100644 index 00000000..d348dd7e --- /dev/null +++ b/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/file/provider/FileManagerTest.java @@ -0,0 +1,46 @@ +/*============LICENSE_START======================================================= + * oom-truststore-merger + * ================================================================================ + * Copyright (C) 2020 Nokia. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + + +package org.onap.oom.truststoremerger.certification.file.provider; + +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.CsvSource; + +import java.io.File; + +import static org.assertj.core.api.Assertions.assertThat; + +class FileManagerTest { + + private FileManager fileManager = new FileManager(); + + @ParameterizedTest + @CsvSource(value = { + "opt/app/truststore.jks:.jks", + "opt/app/truststore.p12:.p12", + "opt/app/truststore.pem:.pem", + "opt/app/truststore:''", + }, delimiter = ':') + void shouldReturnCorrectExtension(String filePath, String expectedExtension){ + String extension = fileManager.getExtension(new File(filePath)); + assertThat(extension).isEqualTo(expectedExtension); + } + +} diff --git a/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/file/provider/PasswordReaderTest.java b/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/file/provider/PasswordReaderTest.java new file mode 100644 index 00000000..712935ac --- /dev/null +++ b/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/file/provider/PasswordReaderTest.java @@ -0,0 +1,44 @@ +/*============LICENSE_START======================================================= + * oom-truststore-merger + * ================================================================================ + * Copyright (C) 2020 Nokia. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.oom.truststoremerger.certification.file.provider; + +import org.junit.jupiter.api.Test; + +import java.io.File; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + +class PasswordReaderTest { + + @Test + void shouldReturnCorrectPasswordFromFile() throws PasswordReaderException { + PasswordReader passwordReader = new PasswordReader(); + String fileData = passwordReader.readPassword(new File("src/test/resources/truststore-jks.pass")); + assertThat(fileData).isEqualTo("EOyuFbuYDyq_EhpboM72RHua"); + } + + @Test + void shouldThrowExceptionForNonExistingFile() { + PasswordReader passwordReader = new PasswordReader(); + assertThatExceptionOfType(PasswordReaderException.class) + .isThrownBy(() -> passwordReader.readPassword(new File("src/test/resources/non-esisting-file.pass"))); + } +} diff --git a/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/file/provider/TruststoreFileFactoryTest.java b/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/file/provider/TruststoreFileFactoryTest.java new file mode 100644 index 00000000..f00b2bc4 --- /dev/null +++ b/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/file/provider/TruststoreFileFactoryTest.java @@ -0,0 +1,114 @@ +/*============LICENSE_START======================================================= + * oom-truststore-merger + * ================================================================================ + * Copyright (C) 2020 Nokia. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + + +package org.onap.oom.truststoremerger.certification.file.provider; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; +import org.onap.oom.truststoremerger.certification.file.JksTruststore; +import org.onap.oom.truststoremerger.certification.file.P12Truststore; +import org.onap.oom.truststoremerger.certification.file.PemTruststore; +import org.onap.oom.truststoremerger.certification.file.TruststoreFile; + +import java.io.File; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + +@ExtendWith(MockitoExtension.class) +class TruststoreFileFactoryTest { + + private static final String TRUSTSTORE_JKS_PATH = "src/test/resources/truststore-jks.jks"; + private static final String TRUSTSTORE_JKS_PASS_PATH = "src/test/resources/truststore-jks.pass"; + private static final String TRUSTSTORE_JKS_PASS = "EOyuFbuYDyq_EhpboM72RHua"; + private static final String TRUSTSTORE_P12_PATH = "src/test/resources/truststore-p12.p12"; + private static final String TRUSTSTORE_P12_PASS_PATH = "src/test/resources/truststore-p12.pass"; + private static final String TRUSTSTORE_P12_PASS = "88y9v5D8H3SG6bZWRVHDfOAo"; + private static final String TRUSTSTORE_PEM_PATH = "src/test/resources/truststore.pem"; + private static final String EMPTY_PASS_PATH = ""; + private static final String TRUSTSTORE_UNKNOWN_EXTENSION_PATH = "src/test/resources/truststore-jks.unknown"; + private static final String NON_EXISTING_TRUSTSTORE_PATH = "src/test/resources/non-existing-truststore.jks"; + + private TruststoreFileFactory truststoreFileFactory; + + @BeforeEach + void setUp() { + truststoreFileFactory = new TruststoreFileFactory(new FileManager(), new PasswordReader()); + } + + @Test + void shouldReturnCorrectJksTruststoreForJksFile() throws TruststoreFileFactoryException, PasswordReaderException { + TruststoreFile truststore = truststoreFileFactory + .create(TRUSTSTORE_JKS_PATH, TRUSTSTORE_JKS_PASS_PATH); + assertThat(truststore).isInstanceOf(JksTruststore.class); + JksTruststore jksTruststore = (JksTruststore) truststore; + assertThat(jksTruststore.getPassword()).isEqualTo(TRUSTSTORE_JKS_PASS); + assertThat(jksTruststore.getTruststoreFile()).isEqualTo(new File(TRUSTSTORE_JKS_PATH)); + } + + @Test + void shouldReturnCorrectP12TruststoreForP12File() throws TruststoreFileFactoryException, PasswordReaderException { + TruststoreFile truststore = truststoreFileFactory + .create(TRUSTSTORE_P12_PATH, + TRUSTSTORE_P12_PASS_PATH); + assertThat(truststore).isInstanceOf(P12Truststore.class); + P12Truststore jksTruststore = (P12Truststore) truststore; + assertThat(jksTruststore.getPassword()).isEqualTo(TRUSTSTORE_P12_PASS); + } + + @Test + void shouldReturnCorrectPemTruststoreForPemFile() throws TruststoreFileFactoryException, PasswordReaderException { + TruststoreFile truststore = truststoreFileFactory + .create(TRUSTSTORE_PEM_PATH, + EMPTY_PASS_PATH); + assertThat(truststore).isInstanceOf(PemTruststore.class); + } + + @Test + void shouldThrowExceptionForInvalidP12PassPath() { + assertThatExceptionOfType(PasswordReaderException.class).isThrownBy( + () -> truststoreFileFactory.create(TRUSTSTORE_P12_PATH, EMPTY_PASS_PATH) + ); + } + + @Test + void shouldThrowExceptionForInvalidJksPassPath() { + assertThatExceptionOfType(PasswordReaderException.class).isThrownBy( + () -> truststoreFileFactory.create(TRUSTSTORE_JKS_PATH, EMPTY_PASS_PATH) + ); + } + + @Test + void shouldThrowExceptionForUnknownTruststoreExtension() { + assertThatExceptionOfType(TruststoreFileFactoryException.class).isThrownBy( + () -> truststoreFileFactory.create(TRUSTSTORE_UNKNOWN_EXTENSION_PATH, TRUSTSTORE_JKS_PASS_PATH) + ); + } + + @Test + void shouldThrowExceptionForNonExistingTruststoreFile() { + assertThatExceptionOfType(TruststoreFileFactoryException.class).isThrownBy( + () -> truststoreFileFactory.create(NON_EXISTING_TRUSTSTORE_PATH, TRUSTSTORE_JKS_PASS_PATH) + ); + } + +} diff --git a/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/file/provider/TruststoreFilesListProviderTest.java b/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/file/provider/TruststoreFilesListProviderTest.java new file mode 100644 index 00000000..034e1b32 --- /dev/null +++ b/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/file/provider/TruststoreFilesListProviderTest.java @@ -0,0 +1,90 @@ +/*============LICENSE_START======================================================= + * oom-truststore-merger + * ================================================================================ + * Copyright (C) 2020 Nokia. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + + +package org.onap.oom.truststoremerger.certification.file.provider; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.onap.oom.truststoremerger.certification.file.JksTruststore; +import org.onap.oom.truststoremerger.certification.file.P12Truststore; +import org.onap.oom.truststoremerger.certification.file.PemTruststore; +import org.onap.oom.truststoremerger.certification.file.TruststoreFile; +import org.onap.oom.truststoremerger.certification.file.TruststoreFileWithPassword; + +import java.io.File; +import java.util.Arrays; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; + +class TruststoreFilesListProviderTest { + + private static final String TRUSTSTORE_JKS_PATH = "src/test/resources/truststore-jks.jks"; + private static final String TRUSTSTORE_JKS_PASS_PATH = "src/test/resources/truststore-jks.pass"; + private static final String TRUSTSTORE_JKS_PASS = "EOyuFbuYDyq_EhpboM72RHua"; + private static final String TRUSTSTORE_P12_PATH = "src/test/resources/truststore-p12.p12"; + private static final String TRUSTSTORE_P12_PASS_PATH = "src/test/resources/truststore-p12.pass"; + private static final String TRUSTSTORE_P12_PASS = "88y9v5D8H3SG6bZWRVHDfOAo"; + private static final String TRUSTSTORE_PEM_PATH = "src/test/resources/truststore.pem"; + private static final String EMPTY_PASS_PATH = ""; + + private TruststoreFilesListProvider truststoreFilesListProvider; + + @BeforeEach + void setUp() { + TruststoreFileFactory truststoreFileFactory = new TruststoreFileFactory(new FileManager(), new PasswordReader()); + truststoreFilesListProvider = new TruststoreFilesListProvider(truststoreFileFactory); + } + + @Test + void shouldReturnTruststoreFilesList() throws PasswordReaderException, TruststoreFileFactoryException { + List truststorePaths = Arrays.asList(TRUSTSTORE_JKS_PATH, TRUSTSTORE_P12_PATH, TRUSTSTORE_PEM_PATH); + List truststorePasswordPaths = Arrays.asList(TRUSTSTORE_JKS_PASS_PATH, TRUSTSTORE_P12_PASS_PATH, EMPTY_PASS_PATH); + List truststoreFilesList = truststoreFilesListProvider.getTruststoreFilesList(truststorePaths, truststorePasswordPaths); + assertThat(truststoreFilesList.size()).isEqualTo(3); + assertCorrectJksTruststore(truststoreFilesList.get(0), TRUSTSTORE_JKS_PATH, TRUSTSTORE_JKS_PASS); + assertCorrectP12Truststore(truststoreFilesList.get(1), TRUSTSTORE_P12_PATH, TRUSTSTORE_P12_PASS); + assertCorrectPemTruststore(truststoreFilesList.get(2), TRUSTSTORE_PEM_PATH); + } + + private void assertCorrectJksTruststore(TruststoreFile truststoreFile, String truststorePath, String truststorePass) { + assertCorrectTypeAndTruststorePath(truststoreFile, truststorePath, JksTruststore.class); + assertContainsCorrectPassword(truststoreFile, truststorePass); + } + + private void assertCorrectP12Truststore(TruststoreFile truststoreFile, String truststorePath, String truststorePass) { + assertCorrectTypeAndTruststorePath(truststoreFile, truststorePath, P12Truststore.class); + assertContainsCorrectPassword(truststoreFile, truststorePass); + } + + private void assertCorrectPemTruststore(TruststoreFile truststoreFile, String truststorePath) { + assertCorrectTypeAndTruststorePath(truststoreFile, truststorePath, PemTruststore.class); + } + + private void assertCorrectTypeAndTruststorePath(TruststoreFile truststoreFile, String truststorePath, Class truststoreType) { + assertThat(truststoreFile).isInstanceOf(truststoreType); + assertThat(truststoreFile.getTruststoreFile()).isEqualTo(new File(truststorePath)); + } + + private void assertContainsCorrectPassword(TruststoreFile truststoreFile, String truststorePass) { + TruststoreFileWithPassword truststoreFileWithPassword = (TruststoreFileWithPassword) truststoreFile; + assertThat(truststoreFileWithPassword.getPassword()).isEqualTo(truststorePass); + } +} diff --git a/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/file/PathValidatorTest.java b/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/path/PathValidatorTest.java similarity index 97% rename from trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/file/PathValidatorTest.java rename to trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/path/PathValidatorTest.java index 1c455764..a11bb232 100644 --- a/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/file/PathValidatorTest.java +++ b/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/path/PathValidatorTest.java @@ -17,7 +17,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.oom.truststoremerger.certification.file; +package org.onap.oom.truststoremerger.certification.path; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; diff --git a/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/file/TruststoresPathsProviderTest.java b/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/path/TruststoresPathsProviderTest.java similarity index 98% rename from trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/file/TruststoresPathsProviderTest.java rename to trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/path/TruststoresPathsProviderTest.java index 6b017709..945a1077 100644 --- a/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/file/TruststoresPathsProviderTest.java +++ b/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/certification/path/TruststoresPathsProviderTest.java @@ -17,7 +17,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.oom.truststoremerger.certification.file; +package org.onap.oom.truststoremerger.certification.path; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/configuration/MergerConfigurationFactoryTest.java b/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/configuration/MergerConfigurationFactoryTest.java index 336ba5da..43b7b9e1 100644 --- a/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/configuration/MergerConfigurationFactoryTest.java +++ b/trustStoreMerger/src/test/java/org/onap/oom/truststoremerger/configuration/MergerConfigurationFactoryTest.java @@ -24,8 +24,8 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; -import org.onap.oom.truststoremerger.certification.file.TruststoresPathsProvider; -import org.onap.oom.truststoremerger.certification.file.TruststoresPathsProviderException; +import org.onap.oom.truststoremerger.certification.path.TruststoresPathsProvider; +import org.onap.oom.truststoremerger.certification.path.TruststoresPathsProviderException; import java.util.ArrayList; import java.util.List; diff --git a/trustStoreMerger/src/test/resources/truststore-jks.jks b/trustStoreMerger/src/test/resources/truststore-jks.jks new file mode 100644 index 00000000..38229811 Binary files /dev/null and b/trustStoreMerger/src/test/resources/truststore-jks.jks differ diff --git a/trustStoreMerger/src/test/resources/truststore-jks.pass b/trustStoreMerger/src/test/resources/truststore-jks.pass new file mode 100644 index 00000000..7426fd4d --- /dev/null +++ b/trustStoreMerger/src/test/resources/truststore-jks.pass @@ -0,0 +1 @@ +EOyuFbuYDyq_EhpboM72RHua \ No newline at end of file diff --git a/trustStoreMerger/src/test/resources/truststore-p12.p12 b/trustStoreMerger/src/test/resources/truststore-p12.p12 new file mode 100644 index 00000000..0fa8aecc Binary files /dev/null and b/trustStoreMerger/src/test/resources/truststore-p12.p12 differ diff --git a/trustStoreMerger/src/test/resources/truststore-p12.pass b/trustStoreMerger/src/test/resources/truststore-p12.pass new file mode 100644 index 00000000..86cc5aac --- /dev/null +++ b/trustStoreMerger/src/test/resources/truststore-p12.pass @@ -0,0 +1 @@ +88y9v5D8H3SG6bZWRVHDfOAo \ No newline at end of file diff --git a/trustStoreMerger/src/test/resources/truststore.pem b/trustStoreMerger/src/test/resources/truststore.pem new file mode 100644 index 00000000..3268e3a6 --- /dev/null +++ b/trustStoreMerger/src/test/resources/truststore.pem @@ -0,0 +1,28 @@ +-----BEGIN CERTIFICATE----- +MIIEszCCAxugAwIBAgIUE+27eIlr12tQ+AMxkJTf2Y+ycOEwDQYJKoZIhvcNAQEL +BQAwYTEjMCEGCgmSJomT8ixkAQEME2MtMDRjYmE2YjhhMDQ5ODEyNGQxFTATBgNV +BAMMDE1hbmFnZW1lbnRDQTEjMCEGA1UECgwaRUpCQ0EgQ29udGFpbmVyIFF1aWNr +c3RhcnQwHhcNMjAwNzA4MTIzODU4WhcNMzAwNzA4MTIzODU4WjBhMSMwIQYKCZIm +iZPyLGQBAQwTYy0wNGNiYTZiOGEwNDk4MTI0ZDEVMBMGA1UEAwwMTWFuYWdlbWVu +dENBMSMwIQYDVQQKDBpFSkJDQSBDb250YWluZXIgUXVpY2tzdGFydDCCAaIwDQYJ +KoZIhvcNAQEBBQADggGPADCCAYoCggGBALTlx22Ld87VO5QgkD7OJvx81a8xLRWt +b4cqmLSBRKw+jTjX4fHCtLh98hXNtYXJ9nxPa2t8MKR/I00Wf1razX1IYN9H/diV +uICjyMxDyK6nwEMpqaWiQgOQx1N4TjNhr19ULTbyFLQMVfXy1OrTsfoWQ2omvRxN +LIoVKwPHd92KG6iqJDZU14ErfA6UtypDV+4rOKQBh0JrfFI/KxKFKRH3e0oDxD8c +PIOUpYVccVv/4Gbc0ZRs8KK0uPZN73LlQccYzPrSk/VAUeuZ52Wqk6dNrq5FHSCe +EwPbx6aqgLwhTLlYAJqmYuDsGU9ZL09buCVKim1pjZiPaoaYAvv3KHdjEKAu9NxF +dezd4JZ24hqYCA7EGnKgyjHxA0SiD/B8f+aBdRGDZbMlH1gKFKivjuHSfPwRv6Op +p8ykEzk3yp0RcqSflVPg0mj+LPViYo/loLLOLybFFR7BetyFieN5QV7BKRyfc7Qi +Se6Idh1nLIrYR9ek8BDkEE9u/JiTT0gP3QIDAQABo2MwYTAPBgNVHRMBAf8EBTAD +AQH/MB8GA1UdIwQYMBaAFDYtHGSe9lYaC9+WnNT91wuiMlkjMB0GA1UdDgQWBBQ2 +LRxknvZWGgvflpzU/dcLojJZIzAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQEL +BQADggGBAIcLj76GVhYSuVaWMMCVlVl8rHhYYufT9z2X7G/0D1G655/dAeAJLltL +S4T7SZI44XKfVH4ztc4TO6OEMLZzslcfDzv/tUzL4EOsXtBTpsK9JgHP2lzCE+aj +a7uxn5SGWlu0YmT/++2d+QYaVVAjqalal8NsppOYCh8GB84TXbQjOMWcR9YBozZf +DSy3/vDNMuggZfdEOMMP57M10NoOKor+8eMGB42k4NR+G2npYHZ4uh1Ifk+eoTAh +o5O0iz3+/8eMTkLavqpnfzBhWHfRTI8wUu6zgm+QI+tsqhPePRuwauD8r79JBnPW +0gayZI5jIWTwvufpweKMgLyQbiGVUDtsr2c43kJ6XHoEf0ACUzbJKtGDD3Y7H/G1 +5Q7hBWbQwhUpiVeRnofS9jHQPWu0Ueq4/784hy+yPWotBIeIWEy4KzKTS+GaRDm0 +OSYtta/BdU0iZO/PzzTC5yIzwrsaq+5Idp16mub7mCAW0B36x0Phmr0DQWpZwxmX +9envV9HcJw== +-----END CERTIFICATE-----