Examples of ExtRAResponse


Examples of org.ejbca.extra.db.ExtRAResponse

   
    SubMessages submessagesresp = msg.getSubMessages(null,null,null);
   
    assertTrue("Number of submessages " + submessagesresp.getSubMessages().size(), submessagesresp.getSubMessages().size() == 1);
   
    ExtRAResponse resp = (ExtRAResponse) submessagesresp.getSubMessages().iterator().next();
    assertTrue("Wrong Request ID" + resp.getRequestId(), resp.getRequestId() == 11);
    assertTrue(resp.isSuccessful() == true);
 
View Full Code Here

Examples of org.ejbca.extra.db.ExtRAResponse

    msghome.create("SimpleCardRenewalTest", smgs);
        Message msg = waitForUser("SimpleCardRenewalTest");
    assertNotNull("No response.", msg);
    SubMessages submessagesresp = msg.getSubMessages(null,null,null);
    assertTrue("Number of submessages " + submessagesresp.getSubMessages().size(), submessagesresp.getSubMessages().size() == 1);
    ExtRAResponse resp = (ExtRAResponse) submessagesresp.getSubMessages().iterator().next();
    assertTrue("Wrong Request ID" + resp.getRequestId(), resp.getRequestId() == 10);
    assertTrue(resp.isSuccessful() == false);
        assertEquals(resp.getFailInfo(), "An authentication cert, a signature cert, an authentication request and a signature request are required");

        // Second fail message
    smgs = new SubMessages(null,null,null);
    smgs.addSubMessage(new CardRenewalRequest(11, null, null, Constants.pkcs10_1, Constants.pkcs10_2));
    msghome.create("SimpleCardRenewalTest", smgs);
        msg = waitForUser("SimpleCardRenewalTest");
    assertNotNull(msg);
    submessagesresp = msg.getSubMessages(null,null,null);
    assertTrue("Number of submessages " + submessagesresp.getSubMessages().size(), submessagesresp.getSubMessages().size() == 1);
    resp = (ExtRAResponse) submessagesresp.getSubMessages().iterator().next();
    assertTrue("Wrong Request ID" + resp.getRequestId(), resp.getRequestId() == 11);
    assertTrue(resp.isSuccessful() == false);
        assertEquals(resp.getFailInfo(), "An authentication cert, a signature cert, an authentication request and a signature request are required");

        // Third fail message
    smgs = new SubMessages(null,null,null);
    smgs.addSubMessage(new CardRenewalRequest(12, cert1, cert1, Constants.pkcs10_1, Constants.pkcs10_2));
    msghome.create("SimpleCardRenewalTest", smgs);
        msg = waitForUser("SimpleCardRenewalTest");
    assertNotNull(msg);
    submessagesresp = msg.getSubMessages(null,null,null);
    assertTrue("Number of submessages " + submessagesresp.getSubMessages().size(), submessagesresp.getSubMessages().size() == 1);
    resp = (ExtRAResponse) submessagesresp.getSubMessages().iterator().next();
    assertTrue("Wrong Request ID" + resp.getRequestId(), resp.getRequestId() == 12);
        assertTrue(resp.isSuccessful() == false);
        assertEquals(resp.getFailInfo(), "Verify failed for signature request");
       
        // Fourth fail message
        smgs = new SubMessages(null,null,null);
        smgs.addSubMessage(new CardRenewalRequest(12, cert1, cert2, Constants.pkcs10_1, Constants.pkcs10_2));
        msghome.create("SimpleCardRenewalTest", smgs);
        msg = waitForUser("SimpleCardRenewalTest");
        assertNotNull(msg);
        submessagesresp = msg.getSubMessages(null,null,null);
        assertTrue("Number of submessages " + submessagesresp.getSubMessages().size(), submessagesresp.getSubMessages().size() == 1);
        resp = (ExtRAResponse) submessagesresp.getSubMessages().iterator().next();
        assertTrue("Wrong Request ID" + resp.getRequestId(), resp.getRequestId() == 12);
        assertTrue(resp.isSuccessful() == false);
        log.debug("resp.getFailInfo: " + resp.getFailInfo());
        assertEquals("Wrong error message.", resp.getFailInfo(), "User status must be new for SimplePKCS10Test1");
       
        // TODO: make a successful message, but user status must be set to new then
  }
View Full Code Here

Examples of org.ejbca.extra.db.ExtRAResponse

    msghome.create(username, smgs);
        Message msg = waitForUser(username);
    assertNotNull("No response.", msg);
    SubMessages submessagesresp = msg.getSubMessages(null,null,null);
    assertTrue("Number of submessages " + submessagesresp.getSubMessages().size(), submessagesresp.getSubMessages().size() == 1);
    ExtRAResponse resp = (ExtRAResponse) submessagesresp.getSubMessages().iterator().next();
    assertTrue("Wrong Request ID: " + resp.getRequestId(), resp.getRequestId() == requestId);
    assertTrue("Edit user failed", resp.isSuccessful() == true);
    // Try to retrieve keystore
    requestId = random.nextLong();
    KeyStoreRetrievalRequest keyStoreRetrievalRequest = new KeyStoreRetrievalRequest(requestId, username, password);
    smgs = new SubMessages(null,null,null);
    smgs.addSubMessage(keyStoreRetrievalRequest);
    msghome.create(username+"ks", smgs);
        msg = waitForUser(username+"ks");
    assertNotNull("No response.", msg);
    submessagesresp = msg.getSubMessages(null,null,null);
    assertTrue("Number of submessages " + submessagesresp.getSubMessages().size(), submessagesresp.getSubMessages().size() == 1);
    resp = (ExtRAResponse) submessagesresp.getSubMessages().iterator().next();
    assertTrue("Wrong Request ID: " + resp.getRequestId(), resp.getRequestId() == requestId);
    assertTrue("KeyStoreRetrieval failed", resp.isSuccessful() == true);
    assertTrue("Wrong response type.", resp instanceof KeyStoreRetrievalResponse);
    KeyStoreRetrievalResponse ksResp = (KeyStoreRetrievalResponse) resp;
    assertTrue("Wrong keystore type.", ksResp.getKeyStoreType() == SecConst.TOKEN_SOFT_P12);
    KeyStore ks = KeyStore.getInstance("PKCS12", "BC");
    try {
View Full Code Here

Examples of org.ejbca.extra.db.ExtRAResponse

    msghome.create(username, smgs);
        Message msg = waitForUser(username);
    assertNotNull("No response.", msg);
    SubMessages submessagesresp = msg.getSubMessages(null,null,null);
    assertTrue("Number of submessages " + submessagesresp.getSubMessages().size(), submessagesresp.getSubMessages().size() == 1);
    ExtRAResponse resp = (ExtRAResponse) submessagesresp.getSubMessages().iterator().next();
    assertTrue("Wrong Request ID" + resp.getRequestId(), resp.getRequestId() == requestId);
    assertTrue("Edit user failed", resp.isSuccessful() == true);
    // Try to retrieve keystore
    requestId = random.nextLong();
    byte[] requestData = NonEjbTestTools.generatePKCS10Req("CN=dummyname", password);
    CertificateRequestRequest certificateRequestRequest = new CertificateRequestRequest(requestId, username, password, CertificateRequestRequest.REQUEST_TYPE_PKCS10, requestData, CertificateRequestRequest.RESPONSE_TYPE_ENCODED);
    smgs = new SubMessages(null,null,null);
    smgs.addSubMessage(certificateRequestRequest);
    msghome.create(username+"csr", smgs);
        msg = waitForUser(username+"csr");
    assertNotNull("No response.", msg);
    submessagesresp = msg.getSubMessages(null,null,null);
    assertTrue("Number of submessages " + submessagesresp.getSubMessages().size(), submessagesresp.getSubMessages().size() == 1);
    resp = (ExtRAResponse) submessagesresp.getSubMessages().iterator().next();
    assertTrue("Wrong Request ID" + resp.getRequestId(), resp.getRequestId() == requestId);
    assertTrue("KeyStoreRetrieval failed", resp.isSuccessful() == true);
    assertTrue("Wrong response type.", resp instanceof CertificateRequestResponse);
    CertificateRequestResponse certResp = (CertificateRequestResponse) resp;
    assertTrue("Wrong keystore type.", certResp.getResponseType() == CertificateRequestRequest.RESPONSE_TYPE_ENCODED);
    assertTrue("Wrong certificate in response", CertTools.getSubjectDN(CertTools.getCertfromByteArray(certResp.getResponseData())).equals("CN="+username));
  }
View Full Code Here

Examples of org.ejbca.extra.db.ExtRAResponse

       
    final Message msg = waitForUser(username + "csr");
        assertNotNull("No response.", msg);
    final SubMessages submessagesresp = msg.getSubMessages(null,null,null);
    assertEquals("Number of submessages " + submessagesresp.getSubMessages().size(), 1, submessagesresp.getSubMessages().size());
    final ExtRAResponse resp = (ExtRAResponse) submessagesresp.getSubMessages().iterator().next();
    assertEquals("Wrong Request ID" + resp.getRequestId(), requestId, resp.getRequestId());
    assertTrue("KeyStoreRetrieval failed: " + resp.getFailInfo(), resp.isSuccessful());
    assertTrue("Wrong response type.", resp instanceof CertificateRequestResponse);
    final CertificateRequestResponse certResp = (CertificateRequestResponse) resp;
    assertEquals("Wrong keystore type.", CertificateRequestRequest.RESPONSE_TYPE_CERTIFICATE, certResp.getResponseType());
    assertEquals("Wrong certificate in response", "CN=" + username, CertTools.getSubjectDN(CertTools.getCertfromByteArray(certResp.getResponseData())));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.