@@ -0,0 +1,1865 @@
+package org.openremote.security;%0A%0Aimport org.testng.annotations.Test;%0A%0Aimport java.io.File;%0Aimport java.security.Security;%0Aimport java.security.cert.Certificate;%0Aimport java.util.UUID;%0A%0A/**%0A * TODO%0A *%0A * @author %3Ca href=%22mailto:juha@openremote.org%22%3EJuha Lindfors%3C/a%3E%0A */%0Apublic class TrustStoreTest%0A%7B%0A%0A  @Test%0A  public void testAddCertBKS() throws Exception%0A  %7B%0A    try%0A    %7B%0A      Security.addProvider(SecurityProvider.BC.getProviderInstance());%0A%0A%0A      char%5B%5D passwd = %22foo%22.toCharArray();%0A%0A      PrivateKeyManager privatekey = PrivateKeyManager.create(KeyManager.Storage.BKS);%0A%0A      Certificate cert = privatekey.addKey(%22test%22, passwd);%0A%0A%0A      File userDir = new File(System.getProperty(%22user.dir%22));%0A      File trustStorefile = new File(userDir, %22truststore%22);%0A      trustStorefile.deleteOnExit();%0A%0A      TrustStore trust = TrustStore.create(trustStorefile.toURI(), KeyManager.Storage.BKS);%0A%0A      trust.addTrustedCertificate(%22mycert%22, cert);%0A    %7D%0A%0A    finally%0A    %7B%0A      Security.removeProvider(SecurityProvider.BC.getProviderInstance().getName());%0A    %7D%0A  %7D%0A%0A%0A%0A  @Test public void testAddCertJCEKS() throws Exception%0A  %7B%0A    try%0A    %7B%0A      Security.addProvider(SecurityProvider.BC.getProviderInstance());%0A%0A%0A      char%5B%5D passwd = %22foo%22.toCharArray();%0A%0A      PrivateKeyManager privatekey = PrivateKeyManager.create(KeyManager.Storage.UBER);%0A%0A      Certificate cert = privatekey.addKey(%22test%22, passwd);%0A%0A%0A      File userDir = new File(System.getProperty(%22user.dir%22));%0A      File trustStorefile = new File(userDir, %22truststore%22 + UUID.randomUUID());%0A      trustStorefile.deleteOnExit();%0A%0A      TrustStore trust = TrustStore.create(trustStorefile.toURI(), KeyManager.Storage.JCEKS);%0A%0A      trust.addTrustedCertificate(%22mycert%22, cert);%0A    %7D%0A%0A    finally%0A    %7B%0A      Security.removeProvider(SecurityProvider.BC.getProviderInstance().getName());%0A    %7D%0A  %7D%0A%0A%7D%0A%0A%0A

include basic trust store test