当前位置: 首页>>代码示例>>Java>>正文


Java SSLSession.getCipherSuite方法代码示例

本文整理汇总了Java中javax.net.ssl.SSLSession.getCipherSuite方法的典型用法代码示例。如果您正苦于以下问题:Java SSLSession.getCipherSuite方法的具体用法?Java SSLSession.getCipherSuite怎么用?Java SSLSession.getCipherSuite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.net.ssl.SSLSession的用法示例。


在下文中一共展示了SSLSession.getCipherSuite方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: get

import javax.net.ssl.SSLSession; //导入方法依赖的package包/类
public static Handshake get(SSLSession session) {
  String cipherSuiteString = session.getCipherSuite();
  if (cipherSuiteString == null) throw new IllegalStateException("cipherSuite == null");
  CipherSuite cipherSuite = CipherSuite.forJavaName(cipherSuiteString);

  String tlsVersionString = session.getProtocol();
  if (tlsVersionString == null) throw new IllegalStateException("tlsVersion == null");
  TlsVersion tlsVersion = TlsVersion.forJavaName(tlsVersionString);

  Certificate[] peerCertificates;
  try {
    peerCertificates = session.getPeerCertificates();
  } catch (SSLPeerUnverifiedException ignored) {
    peerCertificates = null;
  }
  List<Certificate> peerCertificatesList = peerCertificates != null
      ? Util.immutableList(peerCertificates)
      : Collections.<Certificate>emptyList();

  Certificate[] localCertificates = session.getLocalCertificates();
  List<Certificate> localCertificatesList = localCertificates != null
      ? Util.immutableList(localCertificates)
      : Collections.<Certificate>emptyList();

  return new Handshake(tlsVersion, cipherSuite, peerCertificatesList, localCertificatesList);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:Handshake.java

示例2: get

import javax.net.ssl.SSLSession; //导入方法依赖的package包/类
public static Handshake get(SSLSession session) {
    String cipherSuite = session.getCipherSuite();
    if (cipherSuite == null) {
        throw new IllegalStateException("cipherSuite == null");
    }
    Certificate[] peerCertificates;
    List<Certificate> peerCertificatesList;
    List<Certificate> localCertificatesList;
    try {
        peerCertificates = session.getPeerCertificates();
    } catch (SSLPeerUnverifiedException e) {
        peerCertificates = null;
    }
    if (peerCertificates != null) {
        peerCertificatesList = Util.immutableList(peerCertificates);
    } else {
        peerCertificatesList = Collections.emptyList();
    }
    Certificate[] localCertificates = session.getLocalCertificates();
    if (localCertificates != null) {
        localCertificatesList = Util.immutableList(localCertificates);
    } else {
        localCertificatesList = Collections.emptyList();
    }
    return new Handshake(cipherSuite, peerCertificatesList, localCertificatesList);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:27,代码来源:Handshake.java


注:本文中的javax.net.ssl.SSLSession.getCipherSuite方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。