本文整理汇总了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;
}
示例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;
}
示例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();
}
示例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();
}
示例5: getValidNotBefore
import java.security.cert.X509Certificate; //导入方法依赖的package包/类
public Date getValidNotBefore() {
X509Certificate cert = getCertificateList().get(0);
return cert.getNotBefore();
}