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


Java X509Certificate.getNotBefore方法代码示例

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


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

示例1: getCertMessage

import java.security.cert.X509Certificate; //导入方法依赖的package包/类
private String getCertMessage(X509Certificate cert, String host) { 
    CertificateFailure[] certFailures = getCertFailures();
    Object[] param = new Object[7];
    param[0] = host;
    param[1] = cert.getSubjectDN().getName();
    param[2] = cert.getNotBefore();
    param[3] = cert.getNotAfter();
    param[4] = cert.getIssuerDN().getName();
    param[5] = getFingerprint(cert, "SHA1");      // NOI18N
    param[6] = getFingerprint(cert, "MD5");       // NOI18N

    String message = NbBundle.getMessage(SvnClientExceptionHandler.class, "MSG_BadCertificate", param); // NOI18N
    for (CertificateFailure certFailure : certFailures) {
        message = certFailure.message + message;
    }
    return message;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:SvnClientExceptionHandler.java

示例2: getCertificateInfoList

import java.security.cert.X509Certificate; //导入方法依赖的package包/类
@Override
public List<CertificateBasicInfoModel> getCertificateInfoList() throws Exception {
    reloadTrustManager();
    ArrayList<CertificateBasicInfoModel> list = new ArrayList<>();
    Enumeration<String> aliases = this.keyStore.aliases();
    while (aliases.hasMoreElements()) {
        String alias = aliases.nextElement();
        if ("X.509".equals(this.keyStore.getCertificate(alias).getType())) {
            X509Certificate certificate = (X509Certificate) this.keyStore.getCertificate(alias);
            try {
                CertificateBasicInfoModel infoModel = new CertificateBasicInfoModel(
                        alias, getSha1Fingerprint(certificate), certificate.getIssuerDN().getName(),
                        certificate.getNotBefore(), certificate.getNotAfter(), certificate.getSigAlgName(),
                        certificateToString(certificate));

                list.add(infoModel);
            } catch (NoSuchAlgorithmException | CertificateEncodingException e) {
                LOG.error("Failed to add certificate basic info model", e);
            }
        } else {
            list.add(new CertificateBasicInfoModel(alias));
        }
    }
    return list;
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:26,代码来源:X509TrustManagerFactory.java

示例3: getIssueDate

import java.security.cert.X509Certificate; //导入方法依赖的package包/类
static Date getIssueDate() throws Exception {
    KeyStore ks = KeyStore.getInstance("jks");
    try (FileInputStream fis = new FileInputStream("jks")) {
        ks.load(fis, "changeit".toCharArray());
    }
    X509Certificate cert = (X509Certificate)ks.getCertificate("me");
    return cert.getNotBefore();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:9,代码来源:StartDateTest.java

示例4: getIssueDate

import java.security.cert.X509Certificate; //导入方法依赖的package包/类
static Date getIssueDate(String alias) throws Exception {
    KeyStore ks = KeyStore.getInstance("jks");
    try (FileInputStream fis = new FileInputStream("jks")) {
        ks.load(fis, "changeit".toCharArray());
    }
    X509Certificate cert = (X509Certificate)ks.getCertificate(alias);
    return cert.getNotBefore();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:StartDateTest.java

示例5: getValidNotBefore

import java.security.cert.X509Certificate; //导入方法依赖的package包/类
public Date getValidNotBefore() {
    X509Certificate cert = getCertificateList().get(0);
    return cert.getNotBefore();
}
 
开发者ID:Hitachi-Data-Systems,项目名称:Open-DM,代码行数:5,代码来源:SSLCertChain.java


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