1 13 14 package org.ejbca.core.protocol.xkms.generators; 15 16 import java.security.cert.X509Certificate ; 17 import java.util.Iterator ; 18 import java.util.List ; 19 20 import org.ejbca.core.protocol.xkms.common.XKMSConstants; 21 import org.w3._2002._03.xkms_.KeyBindingType; 22 import org.w3._2002._03.xkms_.ValidateRequestType; 23 import org.w3._2002._03.xkms_.ValidateResultType; 24 25 33 34 public class ValidateResponseGenerator extends 35 KISSResponseGenerator { 36 37 38 public ValidateResponseGenerator(String remoteIP, ValidateRequestType req) { 39 super(remoteIP, req); 40 } 41 42 45 public ValidateResultType getResponse(boolean requestVerifies){ 46 ValidateResultType result = xkmsFactory.createValidateResultType(); 47 super.populateResponse(result, requestVerifies); 48 ValidateRequestType req = (ValidateRequestType) this.req; 49 50 51 if(resultMajor == null){ 52 if(!checkValidRespondWithRequest(req.getRespondWith())){ 53 resultMajor = XKMSConstants.RESULTMAJOR_SENDER; 54 resultMinor = XKMSConstants.RESULTMINOR_MESSAGENOTSUPPORTED; 55 } 56 57 if(resultMajor == null){ 58 List <X509Certificate > queryResult = processRequest(req.getQueryKeyBinding()); 59 60 if(resultMajor == null){ 61 Iterator <X509Certificate > iter = queryResult.iterator(); 62 while(iter.hasNext()){ 63 X509Certificate nextCert = iter.next(); 64 result.getKeyBinding().add((KeyBindingType) getResponseValues(req.getQueryKeyBinding(),nextCert,true,false)); 65 66 } 67 } 68 } 69 } 70 71 if(resultMajor == null){ 72 resultMajor = XKMSConstants.RESULTMAJOR_SUCCESS; 73 } 74 75 setResult(result); 76 77 78 79 80 return result; 81 } 82 83 84 85 86 87 88 } 89 | Popular Tags |