Java 类org.bouncycastle.asn1.crmf.CertReqMessages 实例源码

项目:xipki    文件:X509CaCmpResponderImpl.java   
/**
 * 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);
}
项目:xipki    文件:X509CaCmpResponderImpl.java   
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);
}
项目:xipki    文件:X509CaCmpResponderImpl.java   
/**
 * 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);
}
项目:irma_future_id    文件:AllTests.java   
public void testSubsequentMessage()
    throws Exception
{
    KeyPairGenerator kGen = KeyPairGenerator.getInstance("RSA", BC);

    kGen.initialize(512);

    KeyPair kp = kGen.generateKeyPair();
    X509CertificateHolder cert = makeV3Certificate(kp, "CN=Test", kp, "CN=Test");

    ContentSigner signer = new JcaContentSignerBuilder("SHA256withRSA").setProvider(BC).build(
                kp.getPrivate());

    GeneralName user = new GeneralName(new X500Name("CN=Test"));

    CertificateRequestMessageBuilder builder = new JcaCertificateRequestMessageBuilder(
                BigInteger.valueOf(1)).setPublicKey(kp.getPublic()).setProofOfPossessionSubsequentMessage(
                SubsequentMessage.encrCert);

            ProtectedPKIMessage certRequestMsg = new ProtectedPKIMessageBuilder(user,
                user).setTransactionID(new byte[] { 1, 2, 3, 4, 5 }).setBody(
                new PKIBody(PKIBody.TYPE_KEY_UPDATE_REQ, new CertReqMessages(builder.build().toASN1Structure()))).addCMPCertificate(
                cert).build(signer);

    ProtectedPKIMessage msg = new ProtectedPKIMessage(new GeneralPKIMessage(certRequestMsg.toASN1Structure().getEncoded()));

    CertReqMessages reqMsgs = CertReqMessages.getInstance(msg.getBody().getContent());

    CertReqMsg reqMsg = reqMsgs.toCertReqMsgArray()[0];

    assertEquals(ProofOfPossession.TYPE_KEY_ENCIPHERMENT, reqMsg.getPopo().getType());
}
项目:bc-java    文件:AllTests.java   
public void testSubsequentMessage()
    throws Exception
{
    KeyPairGenerator kGen = KeyPairGenerator.getInstance("RSA", BC);

    kGen.initialize(512);

    KeyPair kp = kGen.generateKeyPair();
    X509CertificateHolder cert = makeV3Certificate(kp, "CN=Test", kp, "CN=Test");

    ContentSigner signer = new JcaContentSignerBuilder("SHA256withRSA").setProvider(BC).build(
                kp.getPrivate());

    GeneralName user = new GeneralName(new X500Name("CN=Test"));

    CertificateRequestMessageBuilder builder = new JcaCertificateRequestMessageBuilder(
                BigInteger.valueOf(1)).setPublicKey(kp.getPublic()).setProofOfPossessionSubsequentMessage(
                SubsequentMessage.encrCert);

            ProtectedPKIMessage certRequestMsg = new ProtectedPKIMessageBuilder(user,
                user).setTransactionID(new byte[] { 1, 2, 3, 4, 5 }).setBody(
                new PKIBody(PKIBody.TYPE_KEY_UPDATE_REQ, new CertReqMessages(builder.build().toASN1Structure()))).addCMPCertificate(
                cert).build(signer);

    ProtectedPKIMessage msg = new ProtectedPKIMessage(new GeneralPKIMessage(certRequestMsg.toASN1Structure().getEncoded()));

    CertReqMessages reqMsgs = CertReqMessages.getInstance(msg.getBody().getContent());

    CertReqMsg reqMsg = reqMsgs.toCertReqMsgArray()[0];

    assertEquals(ProofOfPossession.TYPE_KEY_ENCIPHERMENT, reqMsg.getPopo().getType());
}
项目:ipack    文件:PKIBody.java   
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);
    }
}
项目:gwt-crypto    文件:PKIBody.java   
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);
    }
}
项目:Aki-SSL    文件:PKIBody.java   
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);
    }
}
项目:TinyTravelTracker    文件:PKIBody.java   
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);
    }
}
项目:CryptMeme    文件:PKIBody.java   
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);
    }
}
项目:irma_future_id    文件:PKIBody.java   
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);
    }
}
项目:bc-java    文件:PKIBody.java   
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);
    }
}