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_.LocateRequestType; 22 import org.w3._2002._03.xkms_.LocateResultType; 23 import org.w3._2002._03.xkms_.UnverifiedKeyBindingType; 24 25 33 34 public class LocateResponseGenerator extends 35 KISSResponseGenerator { 36 37 38 public LocateResponseGenerator(String remoteIP, LocateRequestType req) { 39 super(remoteIP, req); 40 } 41 42 45 public LocateResultType getResponse(boolean requestVerifies){ 46 LocateResultType result = xkmsFactory.createLocateResultType(); 47 super.populateResponse(result, requestVerifies); 48 LocateRequestType req = (LocateRequestType) 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.getUnverifiedKeyBinding().add((UnverifiedKeyBindingType) getResponseValues(req.getQueryKeyBinding(),nextCert,false,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 |