java.security.Security.removeProvider()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(487)

本文整理了Java中java.security.Security.removeProvider()方法的一些代码示例,展示了Security.removeProvider()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Security.removeProvider()方法的具体详情如下:
包路径:java.security.Security
类名称:Security
方法名:removeProvider

Security.removeProvider介绍

[英]Removes the Provider with the specified name form the collection of providers. If the the Provider with the specified name is removed, all provider at a greater position are shifted down one position.

Returns silently if name is null or no provider with the specified name is installed.
[中]从提供程序集合中删除具有指定名称的提供程序。如果删除了具有指定名称的提供程序,则位于更高位置的所有提供程序将下移一个位置。
如果名称为null或未安装具有指定名称的提供程序,则以静默方式返回。

代码示例

代码示例来源:origin: jenkinsci/jenkins

public Void call() {
  SLAVE_LOG_HANDLER = new RingBufferLogHandler(ringBufferSize);
  // avoid double installation of the handler. JNLP agents can reconnect to the master multiple times
  // and each connection gets a different RemoteClassLoader, so we need to evict them by class name,
  // not by their identity.
  for (Handler h : LOGGER.getHandlers()) {
    if (h.getClass().getName().equals(SLAVE_LOG_HANDLER.getClass().getName()))
      LOGGER.removeHandler(h);
  }
  LOGGER.addHandler(SLAVE_LOG_HANDLER);
  // remove Sun PKCS11 provider if present. See http://wiki.jenkins-ci.org/display/JENKINS/Solaris+Issue+6276483
  try {
    Security.removeProvider("SunPKCS11-Solaris");
  } catch (SecurityException e) {
    // ignore this error.
  }
  try {
    getChannelOrFail().setProperty("slave",Boolean.TRUE); // indicate that this side of the channel is the agent side.
  } catch (ChannelClosedException e) {
    throw new IllegalStateException(e);
  }
  return null;
}
private static final long serialVersionUID = 1L;

代码示例来源:origin: line/armeria

/**
 * Invokes the specified {@link Callable} with {@link BouncyCastleKeyFactoryProvider} enabled temporarily.
 */
public static synchronized <T> T call(Callable<T> task) throws Exception {
  boolean needToAdd = true;
  for (Provider provider : Security.getProviders()) {
    if (provider instanceof BouncyCastleKeyFactoryProvider) {
      needToAdd = false;
      break;
    }
  }
  if (needToAdd) {
    Security.addProvider(new BouncyCastleKeyFactoryProvider());
    try {
      return task.call();
    } finally {
      Security.removeProvider(PROVIDER_NAME);
    }
  } else {
    return task.call();
  }
}

代码示例来源:origin: Javen205/IJPay

/**
 * 添加签名,验签,加密算法提供者
 */
private static void addProvider(){
  if (Security.getProvider("BC") == null) {
    LogUtil.writeLog("add BC provider");
    Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
  } else {
    Security.removeProvider("BC"); //解决eclipse调试时tomcat自动重新加载时,BC存在不明原因异常的问题。
    Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
    LogUtil.writeLog("re-add BC provider");
  }
  printSysInfo();
}

代码示例来源:origin: apache/zookeeper

@AfterClass
public static void tearDownClass() {
  try {
    FileUtils.deleteDirectory(tempDir);
  } catch (IOException e) {
    // ignore
  }
  Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME);
}

代码示例来源:origin: apache/zookeeper

@AfterClass
public static void cleanUpBaseClass() {
  Security.removeProvider("BC");
  cachedTestContexts.clear();
  cachedTestContexts = null;
  try {
    FileUtils.deleteDirectory(tempDir);
  } catch (IOException e) {
    // ignore
  }
}

代码示例来源:origin: apache/zookeeper

@AfterClass
public static void removeBouncyCastleProvider() throws Exception {
  Security.removeProvider("BC");
}

代码示例来源:origin: Alluxio/alluxio

@AfterClass
public static void afterClass() {
 Security.removeProvider(PlainSaslServerProvider.NAME);
}

代码示例来源:origin: auth0/java-jwt

@AfterClass
public static void tearDown() throws Exception {
  Security.removeProvider(bcProvider.getName());
}

代码示例来源:origin: jenkinsci/jenkins

Security.removeProvider("SunPKCS11-Solaris");
} catch (SecurityException e) {

代码示例来源:origin: apache/nifi

Security.removeProvider(saslProvider.getName());

代码示例来源:origin: apache/zookeeper

@After
public void cleanUp() throws Exception {
  clearSSLSystemProperties();
  if (q1 != null) {
    q1.shutdown();
  }
  if (q2 != null) {
    q2.shutdown();
  }
  if (q3 != null) {
    q3.shutdown();
  }
  Security.removeProvider("BC");
  quorumX509Util.close();
}

代码示例来源:origin: org.apache.wss4j/wss4j-ws-security-dom

public static synchronized void cleanUp() {
  if (staticallyInitialized) {
    if (addJceProviders) {
      Security.removeProvider("STRTransform");
      Security.removeProvider("AttachmentContentSignatureTransform");
      Security.removeProvider("AttachmentCompleteSignatureTransform");
    }
    WSProviderConfig.cleanUp();
    staticallyInitialized = false;
  }
}

代码示例来源:origin: be.fedict.eid-applet/eid-applet-test-model

@PreDestroy
  public void stop() {
    if (null != this.provider) {
      Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME);
      this.provider = null;
    }
  }
}

代码示例来源:origin: be.fedict.eid-dss/eid-dss-model

private void unregisterBouncyCastle() {
  if (null == this.managedBouncyCastleProvider) {
    LOG.debug("we don't unregister BouncyCastle");
    return;
  }
  LOG.debug("we unregister BouncyCastle");
  Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME);
}

代码示例来源:origin: apache/cxf

@AfterClass
public static void unregisterBouncyCastleIfNeeded() throws Exception {
  Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME);
}
@Test

代码示例来源:origin: apache/cxf

@AfterClass
public static void unregisterBouncyCastleIfNeeded() throws Exception {
  Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME);
}

代码示例来源:origin: apache/cxf

@AfterClass
public static void unregisterBouncyCastleIfNeeded() throws Exception {
  Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME);
}

代码示例来源:origin: apache/cxf

@AfterClass
public static void unregisterBouncyCastleIfNeeded() throws Exception {
  Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME);
}

代码示例来源:origin: apache/cxf

@AfterClass
public static void unregisterBouncyCastleIfNeeded() throws Exception {
  Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME);
}

代码示例来源:origin: apache/cxf

@AfterClass
public static void unregisterBouncyCastleIfNeeded() throws Exception {
  Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME);
}

相关文章