集册 Java实例教程 获取支持的密码

获取支持的密码

欢马劈雪     最近更新时间:2020-01-02 10:19:05

497
获取支持的密码

// Licensed to the Apache Software Foundation (ASF) under one

import org.apache.log4j.Logger;

import javax.net.ssl.SSLContext;
/**
 * nowjava.com - 时  代  Java 提 供 
**/

import java.security.NoSuchAlgorithmException;

import java.security.NoSuchProviderException;

import java.util.Arrays;

import java.util.HashSet;

import java.util.Set;


public class Main{

    public static String[] getSupportedCiphers()

            throws NoSuchAlgorithmException {

        String[] availableCiphers = getSSLContext().getSocketFactory()

                .getSupportedCipherSuites();

        Arrays.sort(availableCiphers);

        return availableCiphers;

    }

    public static SSLContext getSSLContext()

            throws NoSuchAlgorithmException {
            /*
            时 代      J a v a   公   众 号 - nowjava.com 提 供
            */

        return SSLContext.getInstance("TLSv1");

    }

    public static 
展开阅读全文