Examples of ReissueResultType


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

    private boolean enableXKRSS = true;
    private boolean logExceptions;

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

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

    @Override
    public ReissueResultType reissue(ReissueRequestType request) {
        assertXKRSSAllowed();
        try {
            validateRequest(request);
            ReissueResultType response = XKMSResponseFactory.createResponse(request, new ReissueResultType());
            try {
                for (Register handler : keyRegisterHandlers) {
                    if (handler.canProcess(request)) {
                        return handler.reissue(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 ReissueResultType()));
        }
    }
View Full Code Here

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

            keyBindingType.setKeyInfo(keyInfoType);
            keyBindingType.setId(keyBindingId);
            reissueRequestType.setReissueKeyBinding(keyBindingType);   
                              
            PrivateKey privateKey = (PrivateKey) ks.getKey(alias, keyPass.toCharArray());
            ReissueResultType reissueResultType = getXKMSInvoker().reissue(reissueRequestType, clientCert, privateKey, authPass, privateKey, keyBindingId);           
            
            if(reissueResultType.getResultMajor().equals(XKMSConstants.RESULTMAJOR_SUCCESS) &&
               reissueResultType.getResultMinor() == null){
           
                if(reissueResultType.getKeyBinding().size() >0){
                  KeyBindingType keyBinding = reissueResultType.getKeyBinding().get(0);                 
                  List certs = getCertsFromKeyBinding(keyBinding);
                   
                  X509Certificate userCert = getUserCert(certs);                 
                  certs.remove(userCert);
                     
View Full Code Here

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

 
  /**
   * Returns a reissue response
   */
  public ReissueResultType getResponse(boolean requestVerifies){
    ReissueResultType result = xkmsFactory.createReissueResultType();   
    super.populateResponse(result, requestVerifies);   
    ReissueRequestType req = (ReissueRequestType) this.req;
    // Variables defined here for debug reasons
    boolean isCertValid=false;
    UserDataVO userData = null;
    String password = "";
    X509Certificate newCert = null;
    if(resultMajor == null){    
      if(!checkValidRespondWithRequest(req.getRespondWith(),false)){
        resultMajor = XKMSConstants.RESULTMAJOR_SENDER;
        resultMinor = XKMSConstants.RESULTMINOR_MESSAGENOTSUPPORTED;
      }
      if(resultMajor == null){
        if(resultMajor == null){
          X509Certificate cert = (X509Certificate) getPublicKeyInfo(req, false);
          isCertValid = certIsValid(cert);
          if(isCertValid && confirmPOP(cert.getPublicKey())){           
            userData = findUserData(cert);
            if(userData != null){
              boolean encryptedPassword = isPasswordEncrypted(req);
              if(isCertValid && XKMSConfig.isAutomaticReissueAllowed()){
                password = setUserStatusToNew(userData);
              }else{             
                if(encryptedPassword){
                  password = getEncryptedPassword(requestDoc, userData.getPassword());
                }else{
                  password = getClearPassword(req, userData.getPassword());
                }
              }
              if(password != null ){
                newCert = registerReissueOrRecover(false,true, result, userData,password, cert.getPublicKey(), null);
                if(newCert != null){
                  KeyBindingAbstractType keyBinding = getResponseValues(req.getReissueKeyBinding(), newCert, false, true);
                  result.getKeyBinding().add((KeyBindingType) keyBinding);
                }
              }
            }
          }
        }
View Full Code Here

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

        notBoundAuthenticationType.setProtocol("NOTUSED");
        notBoundAuthenticationType.setValue("ReissuePassword".getBytes());
        authenticationType.setNotBoundAuthentication(notBoundAuthenticationType);
        reissueRequestType.setAuthentication(authenticationType);

        ReissueResultType reissueResultType = xKMSInvoker.reissue(reissueRequestType, null, null, null, keys1.getPrivate(), keyBindingType.getId());

        assertTrue(reissueResultType.getResultMajor().equals(XKMSConstants.RESULTMAJOR_SUCCESS));
        assertTrue(reissueResultType.getResultMinor() == null);

        assertTrue(reissueResultType.getKeyBinding().size() == 1);
        keyBindingType = reissueResultType.getKeyBinding().get(0);
        assertTrue(keyBindingType.getStatus().getValidReason().size() == 4);

        JAXBElement<X509DataType> jAXBX509Data = (JAXBElement<X509DataType>) keyBindingType.getKeyInfo().getContent().get(0);
        assertTrue(jAXBX509Data.getValue().getX509IssuerSerialOrX509SKIOrX509SubjectName().size() == 2);
        Iterator<Object> iter2 = jAXBX509Data.getValue().getX509IssuerSerialOrX509SKIOrX509SubjectName().iterator();
View Full Code Here

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

        notBoundAuthenticationType.setProtocol("NOTUSED");
        notBoundAuthenticationType.setValue("Wrong".getBytes());
        authenticationType.setNotBoundAuthentication(notBoundAuthenticationType);
        reissueRequestType.setAuthentication(authenticationType);

        ReissueResultType reissueResultType = xKMSInvoker.reissue(reissueRequestType, null, null, null, keys1.getPrivate(), keyBindingType.getId());

        assertTrue(reissueResultType.getResultMajor().equals(XKMSConstants.RESULTMAJOR_SENDER));
        assertTrue(reissueResultType.getResultMinor().equals(XKMSConstants.RESULTMINOR_NOAUTHENTICATION));

    }
View Full Code Here

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

        notBoundAuthenticationType.setProtocol("NOTUSED");
        notBoundAuthenticationType.setValue("ReissuePassword".getBytes());
        authenticationType.setNotBoundAuthentication(notBoundAuthenticationType);
        reissueRequestType.setAuthentication(authenticationType);

        ReissueResultType reissueResultType = xKMSInvoker.reissue(reissueRequestType, null, null, null, keys1.getPrivate(), keyBindingType.getId());

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

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

        notBoundAuthenticationType.setProtocol("NOTUSED");
        notBoundAuthenticationType.setValue("ReissuePassword".getBytes());
        authenticationType.setNotBoundAuthentication(notBoundAuthenticationType);
        reissueRequestType.setAuthentication(authenticationType);

        ReissueResultType reissueResultType = xKMSInvoker.reissue(reissueRequestType, null, null, null, keys1.getPrivate(), keyBindingType.getId());

        assertTrue(reissueResultType.getResultMajor().equals(XKMSConstants.RESULTMAJOR_SENDER));
        assertTrue(reissueResultType.getResultMinor().equals(XKMSConstants.RESULTMINOR_REFUSED));
    }
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.