GestoreKeystoreCaching.java

  1. /*
  2.  * GovWay - A customizable API Gateway
  3.  * https://govway.org
  4.  *
  5.  * Copyright (c) 2005-2025 Link.it srl (https://link.it).
  6.  *
  7.  * This program is free software: you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License version 3, as published by
  9.  * the Free Software Foundation.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  * GNU General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18.  *
  19.  */
  20. package org.openspcoop2.pdd.core.keystore;

  21. import java.security.cert.X509Certificate;
  22. import java.util.Map;

  23. import org.openspcoop2.core.config.constants.CostantiConfigurazione;
  24. import org.openspcoop2.pdd.logger.OpenSPCoop2Logger;
  25. import org.openspcoop2.protocol.sdk.state.RequestInfo;
  26. import org.openspcoop2.security.SecurityException;
  27. import org.openspcoop2.security.keystore.CRLCertstore;
  28. import org.openspcoop2.security.keystore.ExternalResource;
  29. import org.openspcoop2.security.keystore.HttpStore;
  30. import org.openspcoop2.security.keystore.JWKSetStore;
  31. import org.openspcoop2.security.keystore.KeyPairStore;
  32. import org.openspcoop2.security.keystore.MerlinKeystore;
  33. import org.openspcoop2.security.keystore.MerlinTruststore;
  34. import org.openspcoop2.security.keystore.MultiKeystore;
  35. import org.openspcoop2.security.keystore.OCSPResponse;
  36. import org.openspcoop2.security.keystore.PublicKeyStore;
  37. import org.openspcoop2.security.keystore.RemoteStore;
  38. import org.openspcoop2.security.keystore.SSLConfigProps;
  39. import org.openspcoop2.security.keystore.SSLSocketFactory;
  40. import org.openspcoop2.security.keystore.SecretKeyStore;
  41. import org.openspcoop2.security.keystore.SymmetricKeystore;
  42. import org.openspcoop2.utils.Utilities;
  43. import org.openspcoop2.utils.cache.Cache;
  44. import org.openspcoop2.utils.cache.CacheAlgorithm;
  45. import org.openspcoop2.utils.cache.CacheType;
  46. import org.openspcoop2.utils.cache.Constants;
  47. import org.openspcoop2.utils.certificate.CertificateInfo;
  48. import org.openspcoop2.utils.certificate.remote.IRemoteStoreProvider;
  49. import org.openspcoop2.utils.certificate.remote.RemoteKeyType;
  50. import org.openspcoop2.utils.certificate.remote.RemoteStoreClientInfo;
  51. import org.openspcoop2.utils.certificate.remote.RemoteStoreConfig;
  52. import org.openspcoop2.utils.transport.http.ExternalResourceConfig;
  53. import org.openspcoop2.utils.transport.http.IOCSPValidator;
  54. import org.openspcoop2.utils.transport.http.SSLConfig;
  55. import org.slf4j.Logger;

  56. /**    
  57.  * GestoreCacheKeystore
  58.  *
  59.  * @author Poli Andrea (poli@link.it)
  60.  * @author $Author$
  61.  * @version $Rev$, $Date$
  62.  */
  63. public class GestoreKeystoreCaching {

  64.     /** Chiave della cache */
  65.     private static final String KEYSTORE_CACHE_NAME = "keystore";
  66.     /** Cache */
  67.     private static Cache cache = null;

  68.    
  69.     private static KeystoreException newKeystoreExceptionGenericError(Exception e) {
  70.         return new KeystoreException("Abilitazione cache per i dati contenenti i keystore non riuscita: "+e.getMessage(),e);
  71.     }

  72.     /* --------------- Cache --------------------*/
  73.     public static boolean isCacheAbilitata() {
  74.         return cache!=null;
  75.     }
  76.     public static void resetCache() throws KeystoreException{
  77.         try{
  78.             if(cache!=null){
  79.                 cache.clear();
  80.             }
  81.         }catch(Exception e){
  82.             throw new KeystoreException("Reset della cache per i dati contenenti i keystore non riuscita: "+e.getMessage(),e);
  83.         }
  84.     }
  85.     public static String printStatsCache(String separator) throws KeystoreException{
  86.         try{
  87.             if(cache!=null){
  88.                 return getStatsCache(separator);
  89.             }else{
  90.                 throw new KeystoreException(Constants.MSG_CACHE_NON_ABILITATA);
  91.             }
  92.         }catch(Exception e){
  93.             throw new KeystoreException("Visualizzazione Statistiche riguardante la cache per i dati contenenti i keystore non riuscita: "+e.getMessage(),e);
  94.         }
  95.     }
  96.     private static String getStatsCache(String separator) throws KeystoreException {
  97.         try{
  98.             String stats = cache.printStats(separator);
  99.             String lifeTimeLabel = "LifeTime:";
  100.             if(stats.contains(lifeTimeLabel)) {
  101.                
  102.                 StringBuilder bf = new StringBuilder();
  103.                 bf.append("CRLsLifeTime:");
  104.                 long lifeTime = GestoreKeystoreCaching.getItemCrlLifeSecond();
  105.                 if(lifeTime>0){
  106.                     bf.append(Utilities.convertSystemTimeIntoStringMillisecondi(lifeTime*1000,false));
  107.                 }
  108.                 else if(lifeTime==0){
  109.                     bf.append("0");
  110.                 }
  111.                 else if(lifeTime<0){
  112.                     bf.append("Infinito");
  113.                 }
  114.                 bf.append(separator);
  115.            
  116.                 return stats.replace(lifeTimeLabel, bf.toString() + lifeTimeLabel);
  117.             }
  118.             else {
  119.                 return stats;
  120.             }
  121.         }catch(Exception e){
  122.             throw new KeystoreException(e.getMessage(),e);
  123.         }
  124.     }
  125.     public static void abilitaCache() throws KeystoreException{
  126.         try{
  127.             if(cache!=null)
  128.                 throw new KeystoreException("Cache gia' abilitata");
  129.             else{
  130.                 abilitaCacheEngine();
  131.             }
  132.         }catch(Exception e){
  133.             throw newKeystoreExceptionGenericError(e);
  134.         }
  135.     }
  136.     private static synchronized void abilitaCacheEngine() throws KeystoreException{
  137.         try{
  138.             if(cache==null) {
  139.                 cache = new Cache(CacheType.JCS, KEYSTORE_CACHE_NAME); // lascio JCS come default abilitato via jmx
  140.                 cache.build();
  141.             }
  142.         }catch(Exception e){
  143.             throw newKeystoreExceptionGenericError(e);
  144.         }
  145.     }
  146.     public static void abilitaCache(Long dimensioneCache,Boolean algoritmoCacheLRU,Long itemIdleTime,Long itemLifeSecond, Logger log) throws KeystoreException{
  147.         try{
  148.             if(cache!=null)
  149.                 throw new KeystoreException("Cache gia' abilitata");
  150.             else{
  151.                 int dimensione = -1;
  152.                 if(dimensioneCache!=null){
  153.                     dimensione = dimensioneCache.intValue();
  154.                 }
  155.                 initCache(CacheType.JCS, dimensione, algoritmoCacheLRU, itemIdleTime, itemLifeSecond, log); // lascio JCS come default abilitato via jmx
  156.             }
  157.         }catch(Exception e){
  158.             throw newKeystoreExceptionGenericError(e);
  159.         }
  160.     }
  161.     public static void disabilitaCache() throws KeystoreException{
  162.         try{
  163.             if(cache==null)
  164.                 throw new KeystoreException("Cache gia' disabilitata");
  165.             else{
  166.                 disabilitaCacheEngine();
  167.             }
  168.         }catch(Exception e){
  169.             throw new KeystoreException("Disabilitazione cache per i dati contenenti i keystore non riuscita: "+e.getMessage(),e);
  170.         }
  171.     }  
  172.     private static synchronized void disabilitaCacheEngine() throws KeystoreException{
  173.         try{
  174.             if(cache!=null) {
  175.                 cache.clear();
  176.                 cache = null;
  177.             }
  178.         }catch(Exception e){
  179.             throw new KeystoreException("Disabilitazione cache per i dati contenenti i keystore non riuscita: "+e.getMessage(),e);
  180.         }
  181.     }  
  182.     public static String listKeysCache(String separator) throws KeystoreException{
  183.         try{
  184.             if(cache!=null){
  185.                 return getKeysCache(separator);
  186.             }else{
  187.                 throw new KeystoreException(Constants.MSG_CACHE_NON_ABILITATA);
  188.             }
  189.         }catch(Exception e){
  190.             throw new KeystoreException("Visualizzazione chiavi presenti nella cache per i dati contenenti i keystore non riuscita: "+e.getMessage(),e);
  191.         }
  192.     }
  193.     private static String getKeysCache(String separator) throws KeystoreException {
  194.         try{
  195.             return cache.printKeys(separator);
  196.         }catch(Exception e){
  197.             throw new KeystoreException(e.getMessage(),e);
  198.         }
  199.     }
  200.    
  201.     public static String getObjectCache(String key) throws KeystoreException{
  202.         try{
  203.             if(cache!=null){
  204.                 return getByKey(key);
  205.             }else{
  206.                 throw new KeystoreException(Constants.MSG_CACHE_NON_ABILITATA);
  207.             }
  208.         }catch(Exception e){
  209.             throw new KeystoreException("Visualizzazione oggetto presente nella cache per i dati contenenti i keystore non riuscita: "+e.getMessage(),e);
  210.         }
  211.     }
  212.     private static String getByKey(String key) throws KeystoreException {
  213.         try{
  214.             Object o = cache.get(key);
  215.             if(o!=null){
  216.                 return o.toString();
  217.             }else{
  218.                 return "oggetto con chiave ["+key+"] non presente";
  219.             }
  220.         }catch(Exception e){
  221.             throw new KeystoreException(e.getMessage(),e);
  222.         }
  223.     }
  224.    
  225.     public static void removeObjectCache(String key) throws KeystoreException{
  226.         try{
  227.             if(cache!=null){
  228.                 removeByKey(key);
  229.             }else{
  230.                 throw new KeystoreException(Constants.MSG_CACHE_NON_ABILITATA);
  231.             }
  232.         }catch(Exception e){
  233.             throw new KeystoreException("Rimozione oggetto presente nella cache per i dati contenenti i keystore non riuscita: "+e.getMessage(),e);
  234.         }
  235.     }
  236.     private static void removeByKey(String key) throws KeystoreException {
  237.         try{
  238.             cache.remove(key);
  239.         }catch(Exception e){
  240.             throw new KeystoreException(e.getMessage(),e);
  241.         }
  242.     }
  243.    

  244.     /*----------------- INIZIALIZZAZIONE --------------------*/

  245.     public static void initialize(Logger log) throws KeystoreException{
  246.         GestoreKeystoreCaching.initialize(null, false, -1,null,-1l,-1l, log);
  247.     }
  248.     public static void initialize(CacheType cacheType, int dimensioneCache,String algoritmoCache,
  249.             long idleTime, long itemLifeSecond, Logger log) throws KeystoreException{
  250.         GestoreKeystoreCaching.initialize(cacheType, true, dimensioneCache,algoritmoCache,idleTime,itemLifeSecond, log);
  251.     }

  252.     private static void initialize(CacheType cacheType, boolean cacheAbilitata,int dimensioneCache,String algoritmoCache,
  253.             long idleTime, long itemLifeSecond, Logger log) throws KeystoreException{

  254.         // Inizializzazione Cache
  255.         if(cacheAbilitata){
  256.             GestoreKeystoreCaching.initCache(cacheType, dimensioneCache, algoritmoCache, idleTime, itemLifeSecond, log);
  257.         }

  258.     }
  259.     private static void initCache(CacheType cacheType, Integer dimensioneCache,String algoritmoCache,Long itemIdleTime,Long itemLifeSecond,Logger alog) throws KeystoreException{
  260.         initCache(cacheType, dimensioneCache, CostantiConfigurazione.CACHE_LRU.toString().equalsIgnoreCase(algoritmoCache), itemIdleTime, itemLifeSecond, alog);
  261.     }
  262.    
  263.     private static void initCache(CacheType cacheType, Integer dimensioneCache,boolean algoritmoCacheLRU,Long itemIdleTime,Long itemLifeSecond,Logger alog) throws KeystoreException{
  264.        
  265.         try {
  266.             cache = new Cache(cacheType, KEYSTORE_CACHE_NAME);
  267.         }catch(Exception e) {
  268.             throw new KeystoreException(e.getMessage(),e);
  269.         }
  270.    
  271.         // dimensione
  272.         initCacheSize(dimensioneCache, alog);
  273.        
  274.         // algoritno
  275.         String msg = "Algoritmo di cache (ResponseCaching) impostato al valore: LRU";
  276.         if(!algoritmoCacheLRU){
  277.             msg = "Algoritmo di cache (ResponseCaching) impostato al valore: MRU";
  278.         }
  279.         alog.info(msg);
  280.         if(!algoritmoCacheLRU)
  281.             cache.setCacheAlgoritm(CacheAlgorithm.MRU);
  282.         else
  283.             cache.setCacheAlgoritm(CacheAlgorithm.LRU);
  284.        
  285.        
  286.         // idle time
  287.         if(itemIdleTime!=null && itemIdleTime>0){
  288.             try{
  289.                 msg = "Attributo 'IdleTime' (ResponseCaching) impostato al valore: "+itemIdleTime;
  290.                 alog.info(msg);
  291.                 cache.setItemIdleTime(itemIdleTime);
  292.             }catch(Exception error){
  293.                 msg = "Parametro errato per l'attributo 'IdleTime' (ResponseCaching): "+error.getMessage();
  294.                 alog.error(msg);
  295.                 throw new KeystoreException(msg,error);
  296.             }
  297.         }
  298.        
  299.         // LifeSecond
  300.         long longItemLife = -1;
  301.         if(itemLifeSecond!=null && itemLifeSecond>0){
  302.             longItemLife = itemLifeSecond.longValue();
  303.         }
  304.         try{
  305.             msg = "Attributo 'MaxLifeSecond' (ResponseCaching) impostato al valore: "+longItemLife;
  306.             alog.info(msg);
  307.             cache.setItemLifeTime(longItemLife);
  308.         }catch(Exception error){
  309.             msg = "Parametro errato per l'attributo 'MaxLifeSecond' (ResponseCaching): "+error.getMessage();
  310.             alog.error(msg);
  311.             throw new KeystoreException(msg,error);
  312.         }
  313.        
  314.         try {
  315.             cache.build();
  316.         }catch(Exception e) {
  317.             throw new KeystoreException(e.getMessage(),e);
  318.         }
  319.        
  320.         // impostazione di JCS nel gestore delle cache dei keystore
  321.        
  322.         org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.setKeystoreCacheJCS(true, longItemLife>0 ? (int)longItemLife : 7200, cache);
  323.     }
  324.    
  325.     private static void initCacheSize(Integer dimensioneCache, Logger alog) throws KeystoreException {
  326.         // dimensione
  327.         if(dimensioneCache!=null && dimensioneCache>0){
  328.             try{
  329.                 String msg = "Dimensione della cache (ResponseCaching) impostata al valore: "+dimensioneCache;
  330.                 alog.info(msg);
  331.                 cache.setCacheSize(dimensioneCache);
  332.             }catch(Exception error){
  333.                 String msg = "Parametro errato per la dimensione della cache (ResponseCaching): "+error.getMessage();
  334.                 alog.error(msg);
  335.                 throw new KeystoreException(msg,error);
  336.             }
  337.         }
  338.     }
  339.    

  340.    
  341.    
  342.     private static long itemCrlLifeSecond;
  343.     public static void setCacheCrlLifeSeconds(long itemCrlLifeSecondParam) {
  344.         itemCrlLifeSecond = itemCrlLifeSecondParam;
  345.         org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.setKeystoreCacheJCSCrlLifeSeconds(itemCrlLifeSecond>0 ? (int)itemCrlLifeSecond : 7200);
  346.     }
  347.     public static long getItemCrlLifeSecond() {
  348.         return itemCrlLifeSecond;
  349.     }
  350.    
  351.    
  352.     private static GestoreKeystoreCaching staticInstance = null;
  353.     public static synchronized void initialize() throws KeystoreException{
  354.         if(staticInstance==null){
  355.             staticInstance = new GestoreKeystoreCaching();
  356.         }
  357.     }
  358.     public static GestoreKeystoreCaching getInstance() throws KeystoreException{
  359.         if(staticInstance==null){
  360.             // spotbugs warning 'SING_SINGLETON_GETTER_NOT_SYNCHRONIZED': l'istanza viene creata allo startup
  361.             synchronized (GestoreKeystoreCaching.class) {
  362.                 throw new KeystoreException("GestoreKeystore non inizializzato");
  363.             }
  364.         }
  365.         return staticInstance;
  366.     }
  367.    
  368.     @SuppressWarnings("unused")
  369.     private Logger log;
  370.    
  371.     private GestoreKeystoreCaching() throws KeystoreException{
  372.         this.log = OpenSPCoop2Logger.getLoggerOpenSPCoopCore();
  373.     }
  374.    
  375.    
  376.    
  377.    
  378.    
  379.    
  380.    
  381.    
  382.    
  383.     /* ********************** ENGINE ************************** */
  384.    
  385.     public static MerlinTruststore getMerlinTruststore(RequestInfo requestInfo, String propertyFilePath) throws SecurityException{
  386.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getMerlinTruststore(requestInfo, propertyFilePath);
  387.     }
  388.     public static MerlinTruststore getMerlinTruststore(RequestInfo requestInfo, String pathStore,String tipoStore,String passwordStore) throws SecurityException{
  389.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getMerlinTruststore(requestInfo, pathStore, tipoStore, passwordStore);
  390.     }
  391.     public static MerlinTruststore getMerlinTruststore(RequestInfo requestInfo, byte[] bytesStore,String tipoStore,String passwordStore) throws SecurityException{
  392.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getMerlinTruststore(requestInfo, bytesStore, tipoStore, passwordStore);
  393.     }
  394.    
  395.    
  396.     public static MerlinKeystore getMerlinKeystore(RequestInfo requestInfo, String propertyFilePath) throws SecurityException{
  397.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getMerlinKeystore(requestInfo, propertyFilePath);
  398.     }
  399.     public static MerlinKeystore getMerlinKeystore(RequestInfo requestInfo, String propertyFilePath,String passwordPrivateKey) throws SecurityException{
  400.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getMerlinKeystore(requestInfo, propertyFilePath, passwordPrivateKey);
  401.     }
  402.     public static MerlinKeystore getMerlinKeystore(RequestInfo requestInfo, String pathStore,String tipoStore,String passwordStore) throws SecurityException{
  403.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getMerlinKeystore(requestInfo, pathStore, tipoStore, passwordStore);
  404.     }
  405.     public static MerlinKeystore getMerlinKeystore(RequestInfo requestInfo, String pathStore,String tipoStore,String passwordStore,String passwordPrivateKey) throws SecurityException{
  406.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getMerlinKeystore(requestInfo, pathStore, tipoStore, passwordStore, passwordPrivateKey);
  407.     }
  408.     public static MerlinKeystore getMerlinKeystore(RequestInfo requestInfo, byte[] bytesStore,String tipoStore,String passwordStore) throws SecurityException{
  409.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getMerlinKeystore(requestInfo, bytesStore, tipoStore, passwordStore);
  410.     }
  411.     public static MerlinKeystore getMerlinKeystore(RequestInfo requestInfo,byte[] bytesStore,String tipoStore,String passwordStore,String passwordPrivateKey) throws SecurityException{
  412.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getMerlinKeystore(requestInfo, bytesStore, tipoStore, passwordStore, passwordPrivateKey);
  413.     }
  414.    
  415.    
  416.     public static SymmetricKeystore getSymmetricKeystore(RequestInfo requestInfo, String alias,String key,String algoritmo) throws SecurityException{
  417.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getSymmetricKeystore(requestInfo, key, alias, algoritmo);
  418.     }
  419.    
  420.    
  421.     public static MultiKeystore getMultiKeystore(RequestInfo requestInfo, String propertyFilePath) throws SecurityException{
  422.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getMultiKeystore(requestInfo, propertyFilePath);
  423.     }
  424.    
  425.    
  426.     public static JWKSetStore getJwkSetStore(RequestInfo requestInfo, String propertyFilePath) throws SecurityException{
  427.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getJwkSetStore(requestInfo, propertyFilePath);
  428.     }
  429.     public static JWKSetStore getJwkSetStore(RequestInfo requestInfo, byte[] archive) throws SecurityException{
  430.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getJwkSetStore(requestInfo, archive);
  431.     }
  432.    
  433.    
  434.     public static KeyPairStore getKeyPairStore(RequestInfo requestInfo, String privateKeyPath, String publicKeyPath, String privateKeyPassword, String algorithm) throws SecurityException{
  435.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getKeyPairStore(requestInfo, privateKeyPath, publicKeyPath, privateKeyPassword, algorithm);
  436.     }
  437.     public static KeyPairStore getKeyPairStore(RequestInfo requestInfo, byte[] privateKey, byte[] publicKey, String privateKeyPassword, String algorithm) throws SecurityException{
  438.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getKeyPairStore(requestInfo, privateKey, publicKey, privateKeyPassword, algorithm);
  439.     }
  440.    
  441.    
  442.     public static PublicKeyStore getPublicKeyStore(RequestInfo requestInfo, String publicKeyPath, String algorithm) throws SecurityException{
  443.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getPublicKeyStore(requestInfo, publicKeyPath, algorithm);
  444.     }
  445.     public static PublicKeyStore getPublicKeyStore(RequestInfo requestInfo, byte[] publicKey, String algorithm) throws SecurityException{
  446.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getPublicKeyStore(requestInfo, publicKey, algorithm);
  447.     }
  448.    
  449.    
  450.     public static SecretKeyStore getSecretKeyStore(RequestInfo requestInfo, String secretKeyPath, String algorithm) throws SecurityException{
  451.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getSecretKeyStore(requestInfo, secretKeyPath, algorithm);
  452.     }
  453.     public static SecretKeyStore getSecretKeyStore(RequestInfo requestInfo, byte[] secretKey, String algorithm) throws SecurityException{
  454.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getSecretKeyStore(requestInfo, secretKey, algorithm);
  455.     }
  456.    
  457.    
  458.     public static RemoteStore getRemoteStore(RequestInfo requestInfo, String keyId, RemoteKeyType keyType, RemoteStoreConfig remoteStoreConfig, IRemoteStoreProvider provider) throws SecurityException{
  459.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getRemoteStore(requestInfo, keyId, keyType, remoteStoreConfig, provider);
  460.     }
  461.     public static void removeRemoteStore(RequestInfo requestInfo, String keyId, RemoteKeyType keyType, RemoteStoreConfig remoteStoreConfig) throws SecurityException{
  462.         org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.removeRemoteStore(requestInfo, keyId, keyType, remoteStoreConfig);
  463.     }
  464.    
  465.     public static RemoteStoreClientInfo getRemoteStoreClientInfo(RequestInfo requestInfo, String keyId, String clientId, RemoteStoreConfig remoteStoreConfig, IRemoteStoreProvider provider,
  466.             org.openspcoop2.utils.Map<Object> context) throws SecurityException{
  467.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getRemoteStoreClientInfo(requestInfo, keyId, clientId, remoteStoreConfig, provider,
  468.                 context);
  469.     }
  470.     public static void removeRemoteStoreClientInfo(RequestInfo requestInfo, String keyId, RemoteStoreConfig remoteStoreConfig) throws SecurityException{
  471.         org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.removeRemoteStoreClientInfo(requestInfo, keyId, remoteStoreConfig);
  472.     }
  473.    
  474.     public static HttpStore getHttpStore(RequestInfo requestInfo, String endpoint) throws SecurityException{
  475.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getHttpStore(requestInfo, endpoint);
  476.     }
  477.     public static HttpStore getHttpStore(RequestInfo requestInfo, String endpoint, Integer connectionTimeout, Integer readTimeout) throws SecurityException{
  478.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getHttpStore(requestInfo, endpoint, connectionTimeout, readTimeout);
  479.     }
  480.     public static HttpStore getHttpStore(RequestInfo requestInfo, String endpoint, MerlinTruststore trustStoreSsl) throws SecurityException{
  481.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getHttpStore(requestInfo, endpoint, trustStoreSsl);
  482.     }
  483.     public static HttpStore getHttpStore(RequestInfo requestInfo, String endpoint, MerlinTruststore trustStoreSsl, CRLCertstore crlTrustStoreSsl) throws SecurityException{
  484.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getHttpStore(requestInfo, endpoint, trustStoreSsl, crlTrustStoreSsl);
  485.     }
  486.     public static HttpStore getHttpStore(RequestInfo requestInfo, String endpoint,
  487.             Integer connectionTimeout, Integer readTimeout,
  488.             MerlinTruststore trustStoreSsl) throws SecurityException{
  489.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getHttpStore(requestInfo, endpoint,
  490.                 connectionTimeout, readTimeout,
  491.                 trustStoreSsl);
  492.     }
  493.     public static HttpStore getHttpStore(RequestInfo requestInfo,String endpoint,
  494.             Integer connectionTimeout, Integer readTimeout,
  495.             MerlinTruststore trustStoreSsl, CRLCertstore crlTrustStoreSsl) throws SecurityException{
  496.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getHttpStore(requestInfo, endpoint,
  497.                 connectionTimeout, readTimeout,
  498.                 trustStoreSsl, crlTrustStoreSsl);
  499.     }
  500.    
  501.    
  502.     public static CRLCertstore getCRLCertstore(RequestInfo requestInfo,String crlPath) throws SecurityException{
  503.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getCRLCertstore(requestInfo,crlPath);
  504.     }
  505.     public static CRLCertstore getCRLCertstore(RequestInfo requestInfo,String crlPath, Map<String, byte[]> localResources) throws SecurityException{
  506.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getCRLCertstore(requestInfo,crlPath,localResources);
  507.     }
  508.    
  509.    
  510.     public static SSLSocketFactory getSSLSocketFactory(RequestInfo requestInfo,SSLConfig sslConfig) throws SecurityException{
  511.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getSSLSocketFactory(requestInfo,sslConfig);
  512.     }
  513.    
  514.    
  515.     public static ExternalResource getExternalResource(RequestInfo requestInfo,String resource, ExternalResourceConfig externalConfig) throws SecurityException{
  516.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getExternalResource(requestInfo, resource, externalConfig);
  517.     }
  518.    
  519.    
  520.     public static SSLConfigProps getSSLConfigProps(RequestInfo requestInfo,String resource, boolean sslConfigRequired) throws SecurityException{
  521.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getSSLConfigProps(requestInfo, resource, sslConfigRequired);
  522.     }
  523.    
  524.    
  525.     public static OCSPResponse getOCSPResponse(RequestInfo requestInfo,IOCSPValidator ocspValidator, X509Certificate cert) throws SecurityException{
  526.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getOCSPResponse(requestInfo, ocspValidator, cert);
  527.     }
  528.     public static OCSPResponse getOCSPResponse(RequestInfo requestInfo,IOCSPValidator ocspValidator, CertificateInfo cert) throws SecurityException{
  529.         return org.openspcoop2.security.keystore.cache.GestoreKeystoreCache.getOCSPResponse(requestInfo, ocspValidator, cert);
  530.     }
  531. }