Examples of RevokeRequestType


Examples of org.apache.cxf.xkms.model.xkms.RevokeRequestType

        assertSuccess(result);
    }

    @Test
    public void checkRevokeWithoutXKRSS() {
        RevokeRequestType request = new RevokeRequestType();
        request.setId("1");
        request.setService(XKMSConstants.XKMS_ENDPOINT_NAME);
        ResultType result = createXKMSService(false).revoke(request);
        assertNotSupported(result);
    }
View Full Code Here

Examples of org.w3._2002._03.xkms_.RevokeRequestType

            String certEncoding = getCertEncoding(args[ARG_CERTENCODING]);           
            Certificate orgCert = getCert(args[ARG_CERT],certEncoding);
            String revokationCode = args[ARG_REVOCATIONCODE];
                                                           
            String reqId = genId();
            RevokeRequestType revokeRequestType = xKMSObjectFactory.createRevokeRequestType();
            revokeRequestType.setId(reqId);
            revokeRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CHAIN);           
            revokeRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_PRIVATEKEY);
           
            X509DataType x509DataType = sigFactory.createX509DataType();
            x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(sigFactory.createX509DataTypeX509Certificate(orgCert.getEncoded()));
            KeyInfoType keyInfoType = sigFactory.createKeyInfoType();
            keyInfoType.getContent().add(sigFactory.createX509Data(x509DataType));
           
            String keyBindingId = "_" + CertTools.getSerialNumber(orgCert).toString();
            KeyBindingType keyBindingType = xKMSObjectFactory.createKeyBindingType();               
            keyBindingType.setKeyInfo(keyInfoType);
            keyBindingType.setId(keyBindingId);
            revokeRequestType.setRevokeKeyBinding(keyBindingType)
           
            byte[] first = XKMSUtil.getSecretKeyFromPassphrase(revokationCode, true,20, XKMSUtil.KEY_REVOCATIONCODEIDENTIFIER_PASS1).getEncoded();
            revokeRequestType.setRevocationCode(first);          
           
            RevokeResultType revokeResultType = getXKMSInvoker().revoke(revokeRequestType, clientCert, privateKey, null,  keyBindingId);

           
            if (revokeResultType.getResultMajor().equals(XKMSConstants.RESULTMAJOR_SUCCESS) && revokeResultType.getResultMinor() == null) {
View Full Code Here

Examples of org.w3._2002._03.xkms_.RevokeRequestType

   * Returns a reissue response
   */
  public RevokeResultType getResponse(boolean requestVerifies){
    RevokeResultType result = xkmsFactory.createRevokeResultType();   
    super.populateResponse(result, requestVerifies);   
    RevokeRequestType req = (RevokeRequestType) this.req;
   

    if(resultMajor == null){    
      if(!checkValidRespondWithRequest(req.getRespondWith(),true)){
        resultMajor = XKMSConstants.RESULTMAJOR_SENDER;
        resultMinor = XKMSConstants.RESULTMINOR_MESSAGENOTSUPPORTED;
      }

      if(resultMajor == null){
        if(resultMajor == null){
          X509Certificate cert = (X509Certificate) getPublicKeyInfo(req, false);
          boolean isCertValid = certIsValid(cert);
          if(isCertValid){           
            UserDataVO userData = findUserData(cert);
            String revocationCodeId = getRevocationCodeFromUserData(userData);
            if(userData != null && revocationCodeId != null){
              String revokeCode = getRevocationCode(req);
              if(XKMSConfig.isRevocationAllowed()){
                if(revokeCode != null ){
                X509Certificate newCert = revoke(revokeCode, revocationCodeId, cert);
                if(newCert != null && req.getRespondWith().size() > 0){
                  KeyBindingAbstractType keyBinding = getResponseValues(req.getRevokeKeyBinding(), newCert, true, false);
                  result.getKeyBinding().add((KeyBindingType) keyBinding);
                }
                }
              }else{
                resultMajor = XKMSConstants.RESULTMAJOR_SENDER;
View Full Code Here

Examples of org.w3._2002._03.xkms_.RevokeRequestType

        assertTrue(recoverResultType.getResultMinor().equals(XKMSConstants.RESULTMINOR_REFUSED));

    }

    public void test17SimpleRevoke() throws Exception {
        RevokeRequestType revokeRequestType = xKMSObjectFactory.createRevokeRequestType();
        revokeRequestType.setId("800");

        X509DataType x509DataType = sigFactory.createX509DataType();
        x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(sigFactory.createX509DataTypeX509Certificate(cert1.getEncoded()));
        KeyInfoType keyInfoType = sigFactory.createKeyInfoType();
        keyInfoType.getContent().add(sigFactory.createX509Data(x509DataType));

        KeyBindingType keyBindingType = xKMSObjectFactory.createKeyBindingType();
        keyBindingType.setKeyInfo(keyInfoType);
        keyBindingType.setId("100123123422");
        revokeRequestType.setRevokeKeyBinding(keyBindingType);

        byte[] first = XKMSUtil.getSecretKeyFromPassphrase("UsersRevokationCodeIdentifier", true, 20, XKMSUtil.KEY_REVOCATIONCODEIDENTIFIER_PASS1).getEncoded();
        revokeRequestType.setRevocationCode(first);

        RevokeResultType revokeResultType = xKMSInvoker.revoke(revokeRequestType, null, null, null, keyBindingType.getId());

        assertTrue(revokeResultType.getResultMajor().equals(XKMSConstants.RESULTMAJOR_SUCCESS));
        assertTrue(revokeResultType.getResultMinor() == null);
View Full Code Here

Examples of org.w3._2002._03.xkms_.RevokeRequestType

        assertTrue(revokeResultType.getResultMinor() == null);

    }

    public void test18RevokeWrongPassword() throws Exception {
        RevokeRequestType revokeRequestType = xKMSObjectFactory.createRevokeRequestType();
        revokeRequestType.setId("801");

        X509DataType x509DataType = sigFactory.createX509DataType();
        x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(sigFactory.createX509DataTypeX509Certificate(cert2.getEncoded()));
        KeyInfoType keyInfoType = sigFactory.createKeyInfoType();
        keyInfoType.getContent().add(sigFactory.createX509Data(x509DataType));

        KeyBindingType keyBindingType = xKMSObjectFactory.createKeyBindingType();
        keyBindingType.setKeyInfo(keyInfoType);
        keyBindingType.setId("100123123422");
        revokeRequestType.setRevokeKeyBinding(keyBindingType);

        revokeRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CERT);

        byte[] first = XKMSUtil.getSecretKeyFromPassphrase("Wrong", true, 20, XKMSUtil.KEY_REVOCATIONCODEIDENTIFIER_PASS1).getEncoded();
        revokeRequestType.setRevocationCode(first);

        RevokeResultType revokeResultType = xKMSInvoker.revoke(revokeRequestType, null, null, null, keyBindingType.getId());

        assertTrue(revokeResultType.getResultMajor().equals(XKMSConstants.RESULTMAJOR_SENDER));
        assertTrue(revokeResultType.getResultMinor().equals(XKMSConstants.RESULTMINOR_NOAUTHENTICATION));
View Full Code Here

Examples of org.w3._2002._03.xkms_.RevokeRequestType

        assertTrue(revokeResultType.getResultMajor().equals(XKMSConstants.RESULTMAJOR_SENDER));
        assertTrue(revokeResultType.getResultMinor().equals(XKMSConstants.RESULTMINOR_NOAUTHENTICATION));
    }

    public void test19RevokeWithResult() throws Exception {
        RevokeRequestType revokeRequestType = xKMSObjectFactory.createRevokeRequestType();
        revokeRequestType.setId("802");

        X509DataType x509DataType = sigFactory.createX509DataType();
        x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(sigFactory.createX509DataTypeX509Certificate(cert2.getEncoded()));
        KeyInfoType keyInfoType = sigFactory.createKeyInfoType();
        keyInfoType.getContent().add(sigFactory.createX509Data(x509DataType));

        KeyBindingType keyBindingType = xKMSObjectFactory.createKeyBindingType();
        keyBindingType.setKeyInfo(keyInfoType);
        keyBindingType.setId("100123123422");
        revokeRequestType.setRevokeKeyBinding(keyBindingType);

        revokeRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CERT);

        byte[] first = XKMSUtil.getSecretKeyFromPassphrase("UsersRevokationCodeId1234", true, 20, XKMSUtil.KEY_REVOCATIONCODEIDENTIFIER_PASS1).getEncoded();
        revokeRequestType.setRevocationCode(first);

        RevokeResultType revokeResultType = xKMSInvoker.revoke(revokeRequestType, null, null, null, keyBindingType.getId());

        assertEquals(XKMSConstants.RESULTMAJOR_SUCCESS, revokeResultType.getResultMajor());
        assertNull(revokeResultType.getResultMinor());
View Full Code Here

Examples of org.w3._2002._03.xkms_.RevokeRequestType

        }
    }

    public void test20RevokeAlreadyRevoked() throws Exception {
        RevokeRequestType revokeRequestType = xKMSObjectFactory.createRevokeRequestType();
        revokeRequestType.setId("804");

        X509DataType x509DataType = sigFactory.createX509DataType();
        x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(sigFactory.createX509DataTypeX509Certificate(cert2.getEncoded()));
        KeyInfoType keyInfoType = sigFactory.createKeyInfoType();
        keyInfoType.getContent().add(sigFactory.createX509Data(x509DataType));

        KeyBindingType keyBindingType = xKMSObjectFactory.createKeyBindingType();
        keyBindingType.setKeyInfo(keyInfoType);
        keyBindingType.setId("100123123422");
        revokeRequestType.setRevokeKeyBinding(keyBindingType);

        revokeRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CERT);

        byte[] first = XKMSUtil.getSecretKeyFromPassphrase("UsersRevokationCodeId1234", true, 20, XKMSUtil.KEY_REVOCATIONCODEIDENTIFIER_PASS1).getEncoded();
        revokeRequestType.setRevocationCode(first);

        RevokeResultType revokeResultType = xKMSInvoker.revoke(revokeRequestType, null, null, null, keyBindingType.getId());

        assertTrue(revokeResultType.getResultMajor().equals(XKMSConstants.RESULTMAJOR_SENDER));
        assertTrue(revokeResultType.getResultMinor().equals(XKMSConstants.RESULTMINOR_REFUSED));
View Full Code Here

Examples of org.w3._2002._03.xkms_.RevokeRequestType

                // Get user's certificate
                Collection<Certificate> userCerts = certificateStoreSession.findCertificatesByUsername(administrator, username);
                assertTrue(userCerts.size() == 1);
                Certificate cert = userCerts.iterator().next();
                // Revoke via XKMS and verify response
                RevokeRequestType revokeRequestType = xKMSObjectFactory.createRevokeRequestType();
                revokeRequestType.setId("808");
                X509DataType x509DataType = sigFactory.createX509DataType();
                x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(sigFactory.createX509DataTypeX509Certificate(cert.getEncoded()));
                KeyInfoType keyInfoType = sigFactory.createKeyInfoType();
                keyInfoType.getContent().add(sigFactory.createX509Data(x509DataType));
                KeyBindingType keyBindingType = xKMSObjectFactory.createKeyBindingType();
                keyBindingType.setKeyInfo(keyInfoType);
                keyBindingType.setId("424242");
                revokeRequestType.setRevokeKeyBinding(keyBindingType);
                first = XKMSUtil.getSecretKeyFromPassphrase("foo123", true, 20, XKMSUtil.KEY_REVOCATIONCODEIDENTIFIER_PASS1).getEncoded();
                revokeRequestType.setRevocationCode(first);
                RevokeResultType revokeResultType = xKMSInvoker.revoke(revokeRequestType, null, null, null, keyBindingType.getId());
                assertTrue(ERRORNOTSENTFORAPPROVAL, revokeResultType.getResultMajor().equals(XKMSConstants.RESULTMAJOR_SUCCESS));
                assertTrue(ERRORNOTSENTFORAPPROVAL, revokeResultType.getResultMinor().equals(XKMSConstants.RESULTMINOR_INCOMPLETE));
                // Try to revoke via XKMS and verify failure
                revokeRequestType = xKMSObjectFactory.createRevokeRequestType();
                revokeRequestType.setId("810");
                x509DataType = sigFactory.createX509DataType();
                x509DataType.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(sigFactory.createX509DataTypeX509Certificate(cert.getEncoded()));
                keyInfoType = sigFactory.createKeyInfoType();
                keyInfoType.getContent().add(sigFactory.createX509Data(x509DataType));
                keyBindingType = xKMSObjectFactory.createKeyBindingType();
                keyBindingType.setKeyInfo(keyInfoType);
                keyBindingType.setId("424242");
                revokeRequestType.setRevokeKeyBinding(keyBindingType);
                first = XKMSUtil.getSecretKeyFromPassphrase("foo123", true, 20, XKMSUtil.KEY_REVOCATIONCODEIDENTIFIER_PASS1).getEncoded();
                revokeRequestType.setRevocationCode(first);
                revokeResultType = xKMSInvoker.revoke(revokeRequestType, null, null, null, keyBindingType.getId());
                assertTrue(ERRORNOTSENTFORAPPROVAL, revokeResultType.getResultMajor().equals(XKMSConstants.RESULTMAJOR_RECIEVER));
                assertTrue(ERRORNOTSENTFORAPPROVAL, revokeResultType.getResultMinor().equals(XKMSConstants.RESULTMINOR_REFUSED));
                // Approve revocation and verify success
                approveRevocation(administrator, approvingAdmin, username, RevokedCertInfo.REVOCATION_REASON_UNSPECIFIED,
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.