Examples of RevokeResultType


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

                XKMSResponseFactory.createResponse(request, new ResultType()));
    }

    @Override
    public RevokeResultType revoke(RevokeRequestType request) {
        RevokeResultType response = XKMSResponseFactory.createResponse(request, new RevokeResultType());
        try {
            assertXKRSSAllowed();
            validateRequest(request);
            for (Register handler : keyRegisterHandlers) {
                if (handler.canProcess(request)) {
View Full Code Here

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

    @Override
    public RevokeResultType revoke(RevokeRequestType request) {
        try {
            assertXKRSSAllowed();
            validateRequest(request);
            RevokeResultType response = XKMSResponseFactory.createResponse(request, new RevokeResultType());
            try {
                for (Register handler : keyRegisterHandlers) {
                    if (handler.canProcess(request)) {
                        return handler.revoke(request, response);
                    }
                }
                throw new UnsupportedOperationException("Service was unable to handle your request");
            } catch (Exception e) {
                LOG.log(Level.SEVERE, "Error due X509 Validation: " + e.getMessage(), e);
                return ExceptionMapper.toResponse(e, response);
            }
        } catch (Exception e) {
            return ExceptionMapper.toResponse(e, XKMSResponseFactory.createResponse(request, new RevokeResultType()));
        }
    }
View Full Code Here

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

            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) {
              getPrintStream().println("Certificate " + CertTools.getSerialNumber(orgCert).toString(16) + " issued by " +
                  CertTools.getIssuerDN(orgCert) + " revoked successfully.");
            } else if (revokeResultType.getResultMajor().equals(XKMSConstants.RESULTMAJOR_SUCCESS) && revokeResultType.getResultMinor().equals(XKMSConstants.RESULTMINOR_INCOMPLETE)) {
              getPrintStream().println("Certificate " + CertTools.getSerialNumber(orgCert).toString(16) + " issued by " +
                  CertTools.getIssuerDN(orgCert) + " successfully sent for approval.");
            } else {
              displayRequestErrors(revokeResultType);
            }
View Full Code Here

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

 
  /**
   * 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;
                resultMinor = XKMSConstants.RESULTMINOR_REFUSED;               
View Full Code Here

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

        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_.RevokeResultType

                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,
                        ApprovalDataVO.APPROVALTYPE_REVOKECERTIFICATE, certificateStoreSession, approvalSession, caID);
                // Try to reactivate user
            } finally {
View Full Code Here

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

        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_.RevokeResultType

        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_.RevokeResultType

        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());

        assertTrue(revokeResultType.getKeyBinding().size() == 1);
        keyBindingType = revokeResultType.getKeyBinding().get(0);
//        for (String s : keyBindingType.getStatus().getValidReason()) {
//          log.debug("ValidReason: " + s);
//        }
        // All Values: http://www.w3.org/2002/03/xkms#IssuerTrust, RevocationStatus, ValidityInterval, Signature
        // Should be: http://www.w3.org/2002/03/xkms#ValidityInterval, IssuerTrust, Signature
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.