本文整理汇总了Java中com.yahoo.athenz.auth.util.Crypto.extractX509CSRDnsNames方法的典型用法代码示例。如果您正苦于以下问题:Java Crypto.extractX509CSRDnsNames方法的具体用法?Java Crypto.extractX509CSRDnsNames怎么用?Java Crypto.extractX509CSRDnsNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.yahoo.athenz.auth.util.Crypto
的用法示例。
在下文中一共展示了Crypto.extractX509CSRDnsNames方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: X509CertRequest
import com.yahoo.athenz.auth.util.Crypto; //导入方法依赖的package包/类
public X509CertRequest(String csr) throws CryptoException {
certReq = Crypto.getPKCS10CertRequest(csr);
if (certReq == null) {
throw new CryptoException("Invalid csr provided");
}
dnsNames = Crypto.extractX509CSRDnsNames(certReq);
ipAddresses = Crypto.extractX509CSRIPAddresses(certReq);
}
示例2: validateCertReqDNSNames
import com.yahoo.athenz.auth.util.Crypto; //导入方法依赖的package包/类
static boolean validateCertReqDNSNames(PKCS10CertificationRequest certReq, final String domain,
final String service) {
// if no dns names in the CSR then we're ok
List<String> dnsNames = Crypto.extractX509CSRDnsNames(certReq);
if (dnsNames.isEmpty()) {
return true;
}
// the only two formats we're allowed to have in the CSR are:
// 1) <service>.<domain-with-dashes>.<provider-dns-suffix>
// 2) <service>.<domain-with-dashes>.instanceid.athenz.<provider-dns-suffix>
final String prefix = service + "." + domain.replace('.', '-') + ".";
for (String dnsName : dnsNames) {
if (dnsName.startsWith(prefix) && dnsName.endsWith(ZTS_CERT_DNS_SUFFIX)) {
continue;
}
if (dnsName.indexOf(ZTSConsts.ZTS_CERT_INSTANCE_ID) != -1) {
continue;
}
LOGGER.error("validateServiceCertReqDNSNames - Invalid dnsName SAN entry: {}", dnsName);
return false;
}
return true;
}
示例3: extractCertReqInstanceId
import com.yahoo.athenz.auth.util.Crypto; //导入方法依赖的package包/类
public static String extractCertReqInstanceId(PKCS10CertificationRequest certReq) {
List<String> dnsNames = Crypto.extractX509CSRDnsNames(certReq);
String reqInstanceId = null;
for (String dnsName : dnsNames) {
int idx = dnsName.indexOf(ZTSConsts.ZTS_CERT_INSTANCE_ID);
if (idx != -1) {
reqInstanceId = dnsName.substring(0, idx);
break;
}
}
return reqInstanceId;
}