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


Java CertificationRequest.getInstance方法代码示例

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


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

示例1: execute0

import org.bouncycastle.asn1.pkcs.CertificationRequest; //导入方法依赖的package包/类
@Override
protected Object execute0() throws Exception {
    CertificationRequest csr = CertificationRequest.getInstance(IoUtil.read(csrFile));
    String sigAlgo = AlgorithmUtil.getSignatureAlgoName(csr.getSignatureAlgorithm());
    boolean bo = securityFactory.verifyPopo(csr, null);
    String txt = bo ? "valid" : "invalid";
    println("The POP is " + txt + " (signature algorithm " + sigAlgo + ").");
    return null;
}
 
开发者ID:xipki,项目名称:xitk,代码行数:10,代码来源:CsrValidateCmd.java

示例2: getBodyForType

import org.bouncycastle.asn1.pkcs.CertificationRequest; //导入方法依赖的package包/类
private static ASN1Encodable getBodyForType(
    int type,
    ASN1Encodable o)
{
    switch (type)
    {
    case TYPE_INIT_REQ:
        return CertReqMessages.getInstance(o);
    case TYPE_INIT_REP:
        return CertRepMessage.getInstance(o);
    case TYPE_CERT_REQ:
        return CertReqMessages.getInstance(o);
    case TYPE_CERT_REP:
        return CertRepMessage.getInstance(o);
    case TYPE_P10_CERT_REQ:
        return CertificationRequest.getInstance(o);
    case TYPE_POPO_CHALL:
        return POPODecKeyChallContent.getInstance(o);
    case TYPE_POPO_REP:
        return POPODecKeyRespContent.getInstance(o);
    case TYPE_KEY_UPDATE_REQ:
        return CertReqMessages.getInstance(o);
    case TYPE_KEY_UPDATE_REP:
        return CertRepMessage.getInstance(o);
    case TYPE_KEY_RECOVERY_REQ:
        return CertReqMessages.getInstance(o);
    case TYPE_KEY_RECOVERY_REP:
        return KeyRecRepContent.getInstance(o);
    case TYPE_REVOCATION_REQ:
        return RevReqContent.getInstance(o);
    case TYPE_REVOCATION_REP:
        return RevRepContent.getInstance(o);
    case TYPE_CROSS_CERT_REQ:
        return CertReqMessages.getInstance(o);
    case TYPE_CROSS_CERT_REP:
        return CertRepMessage.getInstance(o);
    case TYPE_CA_KEY_UPDATE_ANN:
        return CAKeyUpdAnnContent.getInstance(o);
    case TYPE_CERT_ANN:
        return CMPCertificate.getInstance(o);
    case TYPE_REVOCATION_ANN:
        return RevAnnContent.getInstance(o);
    case TYPE_CRL_ANN:
        return CRLAnnContent.getInstance(o);
    case TYPE_CONFIRM:
        return PKIConfirmContent.getInstance(o);
    case TYPE_NESTED:
        return PKIMessages.getInstance(o);
    case TYPE_GEN_MSG:
        return GenMsgContent.getInstance(o);
    case TYPE_GEN_REP:
        return GenRepContent.getInstance(o);
    case TYPE_ERROR:
        return ErrorMsgContent.getInstance(o);
    case TYPE_CERT_CONFIRM:
        return CertConfirmContent.getInstance(o);
    case TYPE_POLL_REQ:
        return PollReqContent.getInstance(o);
    case TYPE_POLL_REP:
        return PollRepContent.getInstance(o);
    default:
        throw new IllegalArgumentException("unknown tag number: " + type);
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:65,代码来源:PKIBody.java

示例3: execute0

import org.bouncycastle.asn1.pkcs.CertificationRequest; //导入方法依赖的package包/类
@Override
protected Object execute0() throws Exception {
    Set<String> issuerNames = qaSystemManager.issuerNames();
    if (isEmpty(issuerNames)) {
        throw new IllegalCmdParamException("no issuer is configured");
    }

    if (issuerName == null) {
        if (issuerNames.size() != 1) {
            throw new IllegalCmdParamException("no issuer is specified");
        }

        issuerName = issuerNames.iterator().next();
    }

    if (!issuerNames.contains(issuerName)) {
        throw new IllegalCmdParamException("issuer " + issuerName
                + " is not within the configured issuers " + issuerNames);
    }

    X509IssuerInfo issuerInfo = qaSystemManager.getIssuer(issuerName);

    X509CertprofileQa qa = qaSystemManager.getCertprofile(profileName);
    if (qa == null) {
        throw new IllegalCmdParamException("found no certificate profile named '"
                + profileName + "'");
    }

    CertificationRequest csr = CertificationRequest.getInstance(IoUtil.read(csrFile));
    Extensions extensions = null;
    CertificationRequestInfo reqInfo = csr.getCertificationRequestInfo();
    ASN1Set attrs = reqInfo.getAttributes();
    for (int i = 0; i < attrs.size(); i++) {
        Attribute attr = Attribute.getInstance(attrs.getObjectAt(i));
        if (PKCSObjectIdentifiers.pkcs_9_at_extensionRequest.equals(attr.getAttrType())) {
            extensions = Extensions.getInstance(attr.getAttributeValues()[0]);
        }
    }

    byte[] certBytes = IoUtil.read(certFile);
    ValidationResult result = qa.checkCert(certBytes, issuerInfo, reqInfo.getSubject(),
            reqInfo.getSubjectPublicKeyInfo(), extensions);
    StringBuilder sb = new StringBuilder();

    sb.append(certFile).append(" (certprofile ").append(profileName).append(")\n");
    sb.append("\tcertificate is ");
    sb.append(result.isAllSuccessful() ? "valid" : "invalid");

    if (verbose.booleanValue()) {
        for (ValidationIssue issue : result.validationIssues()) {
            sb.append("\n");
            format(issue, "    ", sb);
        }
    }

    println(sb.toString());
    if (!result.isAllSuccessful()) {
        throw new CmdFailure("certificate is invalid");
    }
    return null;
}
 
开发者ID:xipki,项目名称:xipki,代码行数:62,代码来源:CheckCertCmd.java


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