/* * Inserts a provider at a specified position * * @param provider * @param position * @return */ public static int insertProviderAt(java.security.Provider provider, int position) { int size = providers.size(); if ((position < 1) || (position > size)) { position = size + 1; } providers.add(position - 1, provider); providersNames.put(provider.getName(), provider); setNeedRefresh(); return(position); }
private static TransformService findInstance(String algorithm, String mechanismType, java.security.Provider provider) {// throws NoSuchAlgorithmException { if (provider == null) { provider = getProvider("TransformService", algorithm, mechanismType); } java.security.Provider.Service ps = provider.getService("TransformService", algorithm); if (ps == null) { throw new java.security.NoSuchAlgorithmException("no such algorithm: " + algorithm + " for provider " + provider.getName()); } TransformService ts = (TransformService)ps.newInstance(null); ts.algorithm = algorithm; ts.mechanism = mechanismType; ts.provider = provider; return(ts); }
/* * Removes the provider * * @param providerNumber */ public static void removeProvider(int providerNumber) { java.security.Provider p = providers.remove(providerNumber - 1); providersNames.remove(p.getName()); setNeedRefresh(); }