001package ca.uhn.hl7v2.hoh.util;
002
003import static org.junit.Assert.*;
004
005import java.io.FileNotFoundException;
006import java.io.IOException;
007import java.security.KeyStore;
008import java.security.KeyStoreException;
009import java.security.NoSuchAlgorithmException;
010import java.security.cert.CertificateException;
011
012import org.junit.Test;
013
014public class KeystoreUtilsTest {
015
016        @Test
017        public void testValidateKeystoreForTlsReceiving() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, FileNotFoundException, IOException {
018
019                KeyStore ks = KeystoreUtils.loadKeystore("src/test/resources/keystore.jks", "changeit");
020                boolean found = KeystoreUtils.validateKeystoreForTlsReceiving(ks);
021                assertTrue(found);
022                
023                ks = KeystoreUtils.loadKeystore("src/test/resources/truststore.jks", "changeit");
024                found = KeystoreUtils.validateKeystoreForTlsReceiving(ks);
025                assertFalse(found);
026                
027        }
028        
029        
030        
031
032}