• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PKIMessage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.bouncycastle.asn1.cmp.PKIMessage的典型用法代码示例。如果您正苦于以下问题:Java PKIMessage类的具体用法?Java PKIMessage怎么用?Java PKIMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PKIMessage类属于org.bouncycastle.asn1.cmp包,在下文中一共展示了PKIMessage类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: finaliseMessage

import org.bouncycastle.asn1.cmp.PKIMessage; //导入依赖的package包/类
private ProtectedPKIMessage finaliseMessage(PKIHeader header, DERBitString protection)
{
    if (!extraCerts.isEmpty())
    {
        CMPCertificate[] cmpCerts = new CMPCertificate[extraCerts.size()];

        for (int i = 0; i != cmpCerts.length; i++)
        {
            cmpCerts[i] = new CMPCertificate(((X509CertificateHolder)extraCerts.get(i)).toASN1Structure());
        }

        return new ProtectedPKIMessage(new PKIMessage(header, body, protection, cmpCerts));
    }
    else
    {
        return new ProtectedPKIMessage(new PKIMessage(header, body, protection));
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:19,代码来源:ProtectedPKIMessageBuilder.java


示例2: addProtection

import org.bouncycastle.asn1.cmp.PKIMessage; //导入依赖的package包/类
private PKIMessage addProtection(PKIMessage pkiMessage, AuditEvent event) {
    try {
        return CmpUtil.addProtection(pkiMessage, getSigner(), getSender(),
                getCmpControl().sendResponderCert());
    } catch (Exception ex) {
        LogUtil.error(LOG, ex, "could not add protection to the PKI message");
        PKIStatusInfo status = generateRejectionStatus(
                PKIFailureInfo.systemFailure, "could not sign the PKIMessage");

        event.setLevel(AuditLevel.ERROR);
        event.setStatus(AuditStatus.FAILED);
        event.addEventData(CaAuditConstants.NAME_message, "could not sign the PKIMessage");
        PKIBody body = new PKIBody(PKIBody.TYPE_ERROR, new ErrorMsgContent(status));
        return new PKIMessage(pkiMessage.getHeader(), body);
    }
}
 
开发者ID:xipki,项目名称:xipki,代码行数:17,代码来源:CmpResponder.java


示例3: buildErrorPkiMessage

import org.bouncycastle.asn1.cmp.PKIMessage; //导入依赖的package包/类
protected PKIMessage buildErrorPkiMessage(ASN1OctetString tid,
        PKIHeader requestHeader, int failureCode, String statusText) {
    GeneralName respRecipient = requestHeader.getSender();

    PKIHeaderBuilder respHeader = new PKIHeaderBuilder(
            requestHeader.getPvno().getValue().intValue(), getSender(), respRecipient);
    respHeader.setMessageTime(new ASN1GeneralizedTime(new Date()));
    if (tid != null) {
        respHeader.setTransactionID(tid);
    }

    ASN1OctetString senderNonce = requestHeader.getSenderNonce();
    if (senderNonce != null) {
        respHeader.setRecipNonce(senderNonce);
    }

    PKIStatusInfo status = generateRejectionStatus(failureCode, statusText);
    ErrorMsgContent error = new ErrorMsgContent(status);
    PKIBody body = new PKIBody(PKIBody.TYPE_ERROR, error);

    return new PKIMessage(respHeader.build(), body);
}
 
开发者ID:xipki,项目名称:xipki,代码行数:23,代码来源:CmpResponder.java


示例4: loadMessage

import org.bouncycastle.asn1.cmp.PKIMessage; //导入依赖的package包/类
private static PKIMessage loadMessage(String name)
{
    String dataHome = System.getProperty(TEST_DATA_HOME);

    if (dataHome == null)
    {
        throw new IllegalStateException(TEST_DATA_HOME + " property not set");
    }

    try
    {
        return PKIMessage.getInstance(ASN1Primitive.fromByteArray(Streams.readAll(new FileInputStream(dataHome + "/cmp/" + name))));
    }
    catch (IOException e)
    {
        throw new RuntimeException(e.toString());
    }
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:19,代码来源:AllTests.java


示例5: ProtectedPKIMessage

import org.bouncycastle.asn1.cmp.PKIMessage; //导入依赖的package包/类
ProtectedPKIMessage(PKIMessage pkiMessage)
{
    if (pkiMessage.getHeader().getProtectionAlg() == null)
    {
        throw new IllegalArgumentException("PKIMessage not protected");
    }

    this.pkiMessage = pkiMessage;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:10,代码来源:ProtectedPKIMessage.java


示例6: generatePkiMessage

import org.bouncycastle.asn1.cmp.PKIMessage; //导入依赖的package包/类
protected PKIMessage generatePkiMessage(InputStream is) throws IOException {
    ASN1InputStream asn1Stream = new ASN1InputStream(is);

    try {
        return PKIMessage.getInstance(asn1Stream.readObject());
    } finally {
        try {
            asn1Stream.close();
        } catch (Exception ex) {
            LOG.error("could not close ASN1 stream: {}", asn1Stream);
        }
    }
}
 
开发者ID:xipki,项目名称:xipki,代码行数:14,代码来源:HttpScepServlet.java


示例7: processCr

import org.bouncycastle.asn1.cmp.PKIMessage; //导入依赖的package包/类
/**
 * handle the PKI body with the choice {@code cr}.
 *
 */
private PKIBody processCr(PKIMessage request, CmpRequestorInfo requestor, ASN1OctetString tid,
        PKIHeader reqHeader, CertReqMessages cr, CmpControl cmpControl, String msgId,
        AuditEvent event) {
    CertRepMessage repMessage = processCertReqMessages(request, requestor, tid, reqHeader,
            cr, false, cmpControl, msgId, event);
    return new PKIBody(PKIBody.TYPE_CERT_REP, repMessage);
}
 
开发者ID:xipki,项目名称:xipki,代码行数:12,代码来源:X509CaCmpResponderImpl.java


示例8: processKur

import org.bouncycastle.asn1.cmp.PKIMessage; //导入依赖的package包/类
private PKIBody processKur(PKIMessage request, CmpRequestorInfo requestor, ASN1OctetString tid,
        PKIHeader reqHeader, CertReqMessages kur, CmpControl cmpControl, String msgId,
        AuditEvent event) {
    CertRepMessage repMessage = processCertReqMessages(request, requestor, tid, reqHeader,
            kur, true, cmpControl, msgId, event);
    return new PKIBody(PKIBody.TYPE_KEY_UPDATE_REP, repMessage);
}
 
开发者ID:xipki,项目名称:xipki,代码行数:8,代码来源:X509CaCmpResponderImpl.java


示例9: processCcp

import org.bouncycastle.asn1.cmp.PKIMessage; //导入依赖的package包/类
/**
 * handle the PKI body with the choice {@code cr}.
 *
 */
private PKIBody processCcp(PKIMessage request, CmpRequestorInfo requestor, ASN1OctetString tid,
        PKIHeader reqHeader, CertReqMessages cr, CmpControl cmpControl, String msgId,
        AuditEvent event) {
    CertRepMessage repMessage = processCertReqMessages(request, requestor, tid, reqHeader,
            cr, false, cmpControl, msgId, event);
    return new PKIBody(PKIBody.TYPE_CROSS_CERT_REP, repMessage);
}
 
开发者ID:xipki,项目名称:xipki,代码行数:12,代码来源:X509CaCmpResponderImpl.java


示例10: testSampleCr

import org.bouncycastle.asn1.cmp.PKIMessage; //导入依赖的package包/类
public void testSampleCr()
    throws Exception
{
    PKIMessage msg = loadMessage("sample_cr.der");
    ProtectedPKIMessage procMsg = new ProtectedPKIMessage(new GeneralPKIMessage(msg));

    assertTrue(procMsg.verify(new PKMACBuilder(new JcePKMACValuesCalculator().setProvider(BC)), "TopSecret1234".toCharArray()));
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:9,代码来源:AllTests.java


示例11: toASN1Structure

import org.bouncycastle.asn1.cmp.PKIMessage; //导入依赖的package包/类
public PKIMessage toASN1Structure()
{
    return pkiMessage;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:5,代码来源:GeneralPKIMessage.java


示例12: processPkiMessage

import org.bouncycastle.asn1.cmp.PKIMessage; //导入依赖的package包/类
PKIMessage processPkiMessage(PKIMessage pkiMessage, X509Certificate tlsClientCert,
AuditEvent event);
 
开发者ID:xipki,项目名称:xipki,代码行数:3,代码来源:X509CaCmpResponder.java


示例13: processP10cr

import org.bouncycastle.asn1.cmp.PKIMessage; //导入依赖的package包/类
/**
 * handle the PKI body with the choice {@code p10cr}<br/>
 * Since it is not possible to add attribute to the PKCS#10 request (CSR), the certificate
 * profile must be specified in the attribute regInfo-utf8Pairs (1.3.6.1.5.5.7.5.2.1) within
 * PKIHeader.generalInfo
 *
 */
private PKIBody processP10cr(PKIMessage request, CmpRequestorInfo requestor,
        ASN1OctetString tid, PKIHeader reqHeader, CertificationRequest p10cr,
        CmpControl cmpControl, String msgId, AuditEvent event) {
    // verify the POP first
    CertResponse certResp;
    ASN1Integer certReqId = new ASN1Integer(-1);

    boolean certGenerated = false;
    X509Ca ca = getCa();

    if (!securityFactory.verifyPopo(p10cr, getCmpControl().popoAlgoValidator())) {
        LOG.warn("could not validate POP for the pkcs#10 requst");
        certResp = buildErrorCertResponse(certReqId, PKIFailureInfo.badPOP, "invalid POP");
    } else {
        CertificationRequestInfo certTemp = p10cr.getCertificationRequestInfo();
        Extensions extensions = CaUtil.getExtensions(certTemp);

        X500Name subject = certTemp.getSubject();
        SubjectPublicKeyInfo publicKeyInfo = certTemp.getSubjectPublicKeyInfo();

        CmpUtf8Pairs keyvalues = CmpUtil.extract(reqHeader.getGeneralInfo());
        String certprofileName = null;
        Date notBefore = null;
        Date notAfter = null;

        if (keyvalues != null) {
            certprofileName = keyvalues.value(CmpUtf8Pairs.KEY_CERT_PROFILE);

            String str = keyvalues.value(CmpUtf8Pairs.KEY_NOT_BEFORE);
            if (str != null) {
                notBefore = DateUtil.parseUtcTimeyyyyMMddhhmmss(str);
            }

            str = keyvalues.value(CmpUtf8Pairs.KEY_NOT_AFTER);
            if (str != null) {
                notAfter = DateUtil.parseUtcTimeyyyyMMddhhmmss(str);
            }
        }

        if (certprofileName == null) {
            certResp = buildErrorCertResponse(certReqId, PKIFailureInfo.badCertTemplate,
                    "badCertTemplate", null);
        } else {
            certprofileName = certprofileName.toUpperCase();
            if (!requestor.isCertProfilePermitted(certprofileName)) {
                String msg = "certprofile " + certprofileName + " is not allowed";
                certResp = buildErrorCertResponse(certReqId,
                        PKIFailureInfo.notAuthorized, msg);
            } else {
                CertTemplateData certTemplateData = new CertTemplateData(subject, publicKeyInfo,
                        notBefore, notAfter, extensions, certprofileName);

                certResp = generateCertificates(Arrays.asList(certTemplateData),
                        Arrays.asList(certReqId), requestor, tid, false, request,
                        cmpControl, msgId, event).get(0);
                certGenerated = true;
            }
        }
    }

    CMPCertificate[] caPubs = null;
    if (certGenerated && cmpControl.sendCaCert()) {
        caPubs = new CMPCertificate[]{ca.caInfo().certInCmpFormat()};
    }
    CertRepMessage repMessage = new CertRepMessage(caPubs, new CertResponse[]{certResp});

    return new PKIBody(PKIBody.TYPE_CERT_REP, repMessage);
}
 
开发者ID:xipki,项目名称:xipki,代码行数:76,代码来源:X509CaCmpResponderImpl.java


示例14: cmpUnRevokeRemoveCertificates

import org.bouncycastle.asn1.cmp.PKIMessage; //导入依赖的package包/类
private PKIBody cmpUnRevokeRemoveCertificates(PKIMessage request, PKIHeaderBuilder respHeader,
        CmpControl cmpControl, PKIHeader reqHeader, PKIBody reqBody, CmpRequestorInfo requestor,
        String msgId, AuditEvent event) {
    Integer requiredPermission = null;
    boolean allRevdetailsOfSameType = true;

    RevReqContent rr = RevReqContent.getInstance(reqBody.getContent());
    RevDetails[] revContent = rr.toRevDetailsArray();

    int len = revContent.length;
    for (int i = 0; i < len; i++) {
        RevDetails revDetails = revContent[i];
        Extensions crlDetails = revDetails.getCrlEntryDetails();
        int reasonCode = CrlReason.UNSPECIFIED.code();
        if (crlDetails != null) {
            ASN1ObjectIdentifier extId = Extension.reasonCode;
            ASN1Encodable extValue = crlDetails.getExtensionParsedValue(extId);
            if (extValue != null) {
                reasonCode = ASN1Enumerated.getInstance(extValue).getValue().intValue();
            }
        }

        if (reasonCode == XiSecurityConstants.CMP_CRL_REASON_REMOVE) {
            if (requiredPermission == null) {
                event.addEventType(CaAuditConstants.TYPE_CMP_rr_remove);
                requiredPermission = PermissionConstants.REMOVE_CERT;
            } else if (requiredPermission != PermissionConstants.REMOVE_CERT) {
                allRevdetailsOfSameType = false;
                break;
            }
        } else if (reasonCode == CrlReason.REMOVE_FROM_CRL.code()) {
            if (requiredPermission == null) {
                event.addEventType(CaAuditConstants.TYPE_CMP_rr_unrevoke);
                requiredPermission = PermissionConstants.UNREVOKE_CERT;
            } else if (requiredPermission != PermissionConstants.UNREVOKE_CERT) {
                allRevdetailsOfSameType = false;
                break;
            }
        } else {
            if (requiredPermission == null) {
                event.addEventType(CaAuditConstants.TYPE_CMP_rr_revoke);
                requiredPermission = PermissionConstants.REVOKE_CERT;
            } else if (requiredPermission != PermissionConstants.REVOKE_CERT) {
                allRevdetailsOfSameType = false;
                break;
            }
        }
    } // end for

    if (!allRevdetailsOfSameType) {
        ErrorMsgContent emc = new ErrorMsgContent(
                new PKIStatusInfo(PKIStatus.rejection,
                new PKIFreeText("not all revDetails are of the same type"),
                new PKIFailureInfo(PKIFailureInfo.badRequest)));

        return new PKIBody(PKIBody.TYPE_ERROR, emc);
    } else {
        try {
            checkPermission(requestor, requiredPermission);
        } catch (InsuffientPermissionException ex) {
            event.setStatus(AuditStatus.FAILED);
            event.addEventData(CaAuditConstants.NAME_message, "NOT_PERMITTED");
            return buildErrorMsgPkiBody(PKIStatus.rejection, PKIFailureInfo.notAuthorized,
                    null);
        }
        return unRevokeRemoveCertificates(request, rr, requiredPermission, cmpControl, msgId);
    }
}
 
开发者ID:xipki,项目名称:xipki,代码行数:69,代码来源:X509CaCmpResponderImpl.java


示例15: GeneralPKIMessage

import org.bouncycastle.asn1.cmp.PKIMessage; //导入依赖的package包/类
/**
 * Wrap a PKIMessage ASN.1 structure.
 *
 * @param pkiMessage base PKI message.
 */
public GeneralPKIMessage(PKIMessage pkiMessage)
{
    this.pkiMessage = pkiMessage;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:10,代码来源:GeneralPKIMessage.java


示例16: toASN1Structure

import org.bouncycastle.asn1.cmp.PKIMessage; //导入依赖的package包/类
/**
 * Return the underlying ASN.1 structure contained in this object.
 *
 * @return a PKIMessage structure.
 */
public PKIMessage toASN1Structure()
{
    return pkiMessage;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:10,代码来源:ProtectedPKIMessage.java


示例17: processPkiMessage0

import org.bouncycastle.asn1.cmp.PKIMessage; //导入依赖的package包/类
/**
 * Processes the request and returns the response.
 * @param request
 *          Original request. Will only be used for the storage. Could be{@code null}.
 * @param requestor
 *          Requestor. Must not be {@code null}.
 * @param transactionId
 *          Transaction id. Must not be {@code null}.
 * @param pkiMessage
 *          PKI message. Must not be {@code null}.
 * @param msgId
 *          Message id. Must not be {@code null}.
 * @param event
 *          Audit event. Must not be {@code null}.
 * @return the response
 */
protected abstract PKIMessage processPkiMessage0(PKIMessage request, RequestorInfo requestor,
        ASN1OctetString transactionId, GeneralPKIMessage pkiMessage, String msgId,
        AuditEvent event);
 
开发者ID:xipki,项目名称:xipki,代码行数:20,代码来源:CmpResponder.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SetEntityMotionPacket类代码示例发布时间:2022-05-23
下一篇:
Java SpriteCache类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap