java.security.Provider.getInfo()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(10.2k)|赞(0)|评价(0)|浏览(134)

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

Provider.getInfo介绍

[英]Returns a description of the services being provided.
[中]返回所提供服务的描述。

代码示例

代码示例来源:origin: camunda/camunda-bpm-platform

System.out.print("(using secure random generator, info = '"+r.getProvider().getInfo()+"')");

代码示例来源:origin: stackoverflow.com

for (Provider p : Security.getProviders()) {

  log.debug(p.getName());
  log.debug(p.getInfo());
}

代码示例来源:origin: stackoverflow.com

for (Provider p : Security.getProviders()) {
  System.out.printf("%s -> %s\n", p.getName(), p.getInfo());
}

代码示例来源:origin: org.glassfish.main.common/amx-core

public String
  stringify( Object object )
  {
    final Provider	provider	= (Provider)object;
    
    final StringBuffer	buf	= new StringBuffer();

    buf.append( provider.getInfo() );
    
    java.util.Iterator    iter    = provider.entrySet().iterator();
    while ( iter.hasNext() )
    {
      buf.append( iter.next().toString() + "\n" );
    }

    return( buf.toString() );
  }
}

代码示例来源:origin: org.glassfish.common/amx-core

public String
  stringify( Object object )
  {
    final Provider	provider	= (Provider)object;
    
    final StringBuffer	buf	= new StringBuffer();

    buf.append( provider.getInfo() );
    
    java.util.Iterator    iter    = provider.entrySet().iterator();
    while ( iter.hasNext() )
    {
      buf.append( iter.next().toString() + "\n" );
    }

    return( buf.toString() );
  }
}

代码示例来源:origin: wildfly/wildfly-core

/**
 * Populate the supplied response {@link ModelNode} with information about the supplied {@link Provider}
 *
 * @param response the response to populate.
 * @param provider the {@link Provider} to use when populating the response.
 */
static void populateProvider(final ModelNode response, final Provider provider, final boolean includeServices) {
  response.get(ElytronDescriptionConstants.NAME).set(provider.getName());
  response.get(ElytronDescriptionConstants.INFO).set(provider.getInfo());
  response.get(ElytronDescriptionConstants.VERSION).set(provider.getVersion());
  if (includeServices) {
    addServices(response, provider);
  }
}

代码示例来源:origin: org.w3c.jigsaw/jigsaw

/**
 * Adds a security provider.
 *
 * @param provider  the provider class name in question
 * @throws java.lang.ClassNotFoundException  if the provider is unavailable
 * @throws java.lang.IllegalAccessException  if the provider has no
 *         accessible default constructor
 * @throws java.lang.InstantiationException  if the provider cannot be
 *         instantiated
 */
private static final void addProvider(String provider) 
  throws ClassNotFoundException, IllegalAccessException,
    InstantiationException
{
  if (null != provider) {
  if (null == Security.getProvider(provider)) {
  Class support = Class.forName(provider);
  Provider supplier = (Provider)support.newInstance();
  Security.addProvider(supplier);
  if (debug) {
    System.out.println("Added new security provider: " + 
          supplier.getInfo() + ".");
  }
  }
  }
}

代码示例来源:origin: org.eclipse.equinox.security/ui

private void appendProvider(PrintWriter writer, Provider provider, int index) {
  writer.println(" Provider: " + provider.getName() + ", Version: " + provider.getVersion() + ", Class: " + provider.getClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
  writer.println("  Description: " + provider.getInfo()); //$NON-NLS-1$
  ProviderService[] services = getServices(provider);
  writer.println("  Services (" + services.length + "):"); //$NON-NLS-1$  //$NON-NLS-2$
  for (int i = 0; i < services.length; i++) {
    appendService(writer, services[i], i);
  }
  writer.println();
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.equinox.security.ui

private void appendProvider(PrintWriter writer, Provider provider, int index) {
  writer.println(" Provider: " + provider.getName() + ", Version: " + provider.getVersion() + ", Class: " + provider.getClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
  writer.println("  Description: " + provider.getInfo()); //$NON-NLS-1$
  ProviderService[] services = getServices(provider);
  writer.println("  Services (" + services.length + "):"); //$NON-NLS-1$  //$NON-NLS-2$
  for (int i = 0; i < services.length; i++) {
    appendService(writer, services[i], i);
  }
  writer.println();
}

代码示例来源:origin: eidottermihi/rpicheck

LOGGER.debug("+++ Registered JCE providers +++");
for (Provider prov : providers) {
  LOGGER.debug("Provider: {} - {}", prov.getName(), prov.getInfo());

代码示例来源:origin: com.addc/addc-security

/**
 * Get a Signature with the wrapped characteristics and the given key
 * 
 * @param key
 *            The key to use
 * @return A Signature
 * @throws NoSuchAlgorithmException
 *             If the algorithm name is incorrect
 * @throws InvalidKeyException
 *             If the key is incorrect
 */
public Signature getSignatureObject(PrivateKey key) throws InvalidKeyException, NoSuchAlgorithmException {
  final Signature signature= getSignatureObject();
  signature.initSign(key);
  LOGGER.debug("Instantiated algorithm {} with provider {}", signatureName, signature.getProvider().getInfo());
  return signature;
}

代码示例来源:origin: com.addc/addc-security

/**
 * Get a Mac with the wrapped characteristics and the given key
 * 
 * @param key
 *            The key used to generate the Mac
 * @return The mac
 * @throws NoSuchAlgorithmException
 *             If the algorithm name is incorrect
 * @throws InvalidKeyException
 *             If the key is incorrect
 */
public Mac getMac(Key key) throws InvalidKeyException, NoSuchAlgorithmException {
  final Mac mac= getMac();
  mac.init(key);
  LOGGER.debug("Instantiated algorithm {} with provider {}", hmacName, mac.getProvider().getInfo());
  return mac;
}

代码示例来源:origin: org.eclipse.equinox.security/ui

public void handleEvent(Event event) {
    Provider provider = Security.getProviders()[providerCombo.getSelectionIndex()];
    providerViewer.setInput(getContent(provider));
    versionText.setText(String.valueOf(provider.getVersion()));
    descriptionText.setText(provider.getInfo());
  }
});

代码示例来源:origin: stackoverflow.com

Provider[] providers = Security.getProviders();
for (Provider p : providers) {
 String providerStr = String.format("%s/%s/%f\n", p.getName(),
          p.getInfo(), p.getVersion());
 Set<Service> services = p.getServices();
 for (Service s : services) {
  if ("MessageDigest".equals(s.getType())) {
    System.out.printf("\t%s/%s/%s", s.getType(),
              s.getAlgorithm(), s.getClassName());
  }
 }
}

代码示例来源:origin: stackoverflow.com

import java.security.Provider;
import java.security.Provider.Service;
import java.security.Security;
import java.util.Set;

public class MainActivity
{
 public static void main(String[] args)
 {
  Provider [] providerList = Security.getProviders();
  for (Provider provider : providerList)
   {
    System.out.println("Name: "  + provider.getName());
    System.out.println("Information:\n" + provider.getInfo());

    Set<Service> serviceList = provider.getServices();
    for (Service service : serviceList)
    {
     System.out.println("Service Type: " + service.getType() + " Algorithm " + service.getAlgorithm());
    }
   }
 }
}

代码示例来源:origin: stackoverflow.com

//Moves provider to first place
static void initSecurity(java.security.Provider provider){
  listProviders();
  java.security.Security.removeProvider(provider.getName());

  int insertProviderAt = java.security.Security.insertProviderAt(provider, 1);
  mLog.debug("insertProviderAt:\t" + Integer.toString(insertProviderAt) ) ;
  listProviders();
}//initSecurity


static public void listProviders(){
  java.security.Provider[] providers = java.security.Security.getProviders();
  StringBuilder list = new StringBuilder().append("Num providers: " + providers.length );
  int i = 0;
  for (java.security.Provider p : providers){
    list.append("\n\tProvider " + ++i + ": " + p.getName() + "\t info: " + p.getInfo());
    java.util.Set<java.security.Provider.Service> services = p.getServices();
    list.append("\tNum services: " + services.size());
    for (java.security.Provider.Service s : services ){
      //list.append("\n\t\tService: " + s.toString() + "\ttype: " + s.getType() + "\talgo: " + s.getAlgorithm());
    }
  }

  mLog.debug(list.toString());
}//listProviders

代码示例来源:origin: stackoverflow.com

static public void listAlgorithms( String algFilter ){
  java.security.Provider[] providers = java.security.Security.getProviders();
  for ( java.security.Provider p : providers ){
    String providerStr = String.format( "%s/%s/%f\n", p.getName(), p.getInfo(),
                      p.getVersion() );
    mLog.debug( providerStr );
    Set< Service > services = p.getServices();
    List< String > algs = new ArrayList<>();
    for ( Service s : services ){
      boolean match = true;
      if ( algFilter != null ){
        match = s.getAlgorithm().toLowerCase().contains( algFilter.toLowerCase() );
      }

      if ( match ){
        String algStr = String.format( "\t%s/%s/%s", s.getType(),
                        s.getAlgorithm(), s.getClassName() );
        algs.add( algStr );
      }
    }

    Collections.sort( algs );
    for ( String alg : algs ) mLog.debug( "\t" + alg );
    mLog.debug( "" );
  }
}//listAlgorithms

代码示例来源:origin: arhs/sd-dss

@SuppressWarnings("restriction")
private Provider getProvider() {
  try {
    if (_pkcs11Provider == null) {
      // check if the provider already exists
      final Provider[] providers = Security.getProviders();
      if (providers != null) {
        for (final Provider provider : providers) {
          final String providerInfo = provider.getInfo();
          if (providerInfo.contains(getPkcs11Path())) {
            _pkcs11Provider = provider;
            return provider;
          }
        }
      }
      // provider not already installed
      installProvider();
    }
    return _pkcs11Provider;
  } catch (ProviderException ex) {
    throw new DSSConfigurationException(DSSConfigurationException.MSG.NOT_PKCS11_LIB, ex);
  }
}

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

public Boolean run() {
    addXMLDSigRI();
    String bcProviderStr = 
      addJceProvider("BC", "org.bouncycastle.jce.provider.BouncyCastleProvider");
    // If we have BouncyCastle v1.49 installed then use IvParameterSpec in
    // Santuario. This can be removed when we pick up BouncyCastle 1.51+
    if (bcProviderStr != null) {
      Provider bcProvider = Security.getProvider(bcProviderStr);
      if (bcProvider.getInfo().contains("v1.49")) {
        useIvParameterSpec();
      }
    }
    Security.removeProvider("STRTransform");
    appendJceProvider(
      "STRTransform", new org.apache.ws.security.transform.STRTransformProvider()
    );
    
    return true;
  }
});

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.wss4j

public Boolean run() {
    addXMLDSigRI();
    String bcProviderStr = 
      addJceProvider("BC", "org.bouncycastle.jce.provider.BouncyCastleProvider");
    // If we have BouncyCastle v1.49 installed then use IvParameterSpec in
    // Santuario. This can be removed when we pick up BouncyCastle 1.51+
    if (bcProviderStr != null) {
      Provider bcProvider = Security.getProvider(bcProviderStr);
      if (bcProvider.getInfo().contains("v1.49")) {
        useIvParameterSpec();
      }
    }
    Security.removeProvider("STRTransform");
    appendJceProvider(
      "STRTransform", new org.apache.ws.security.transform.STRTransformProvider()
    );
    
    return true;
  }
});

相关文章