after requests a key recovery with:
public RequestId requestRecoveryPrivateKey(KeyId keyID,String base64Certificate) throws Exception { //trim header and footer from cert if(base64Certificate.contains(CertData.HEADER)) { base64Certificate = base64Certificate.substring(CertData.HEADER.length(), base64Certificate.indexOf(CertData.FOOTER)); }
log("Requesting X509 key recovery." + keyID); KeyRequestResponse response = keyClient.recoverKey(keyID, null, null, null, base64Certificate); RequestId requestId = response.getRequestId(); log("ask kra admins to approve request "+requestId);
KeyRequestInfo info = keyClient.getRequestInfo(requestId); log("info about request to approve"); printRequestInfo(info);
return requestId; }
when I try to find request by keyId public List<KeyRequestInfo> findRecoveryRequest(KeyId keyid) { // String requestState, // String requestType, // String clientID, // RequestId start, // Integer pageSize, // Integer maxResults, // Integer maxTime) ArrayList<KeyRequestInfo> result = new ArrayList<KeyRequestInfo>(); KeyRequestInfoCollection requests = keyClient.listRequests(null, "recovery", null, null, 99999, Integer.MAX_VALUE, 99999); for (KeyRequestInfo keyRequestInfo : requests.getEntries()) { KeyId reqKeyId = keyRequestInfo.getKeyId(); printRequestInfo(keyRequestInfo); log("req "+keyRequestInfo.getRequestId()+" "+reqKeyId+"==" +keyid); if(keyid.equals(keyRequestInfo.getKeyId())) { result.add(keyRequestInfo); } } log("found " + result.size() + " requests"); return result; } keyClient.listRequests(null, "recovery", null, null, 99999, Integer.MAX_VALUE, 99999); returns collection with null KeyUrl so getKeyId returns also a null but when I open requests with some null in KeyUrl in agent (https://localhost.localdomain:8443/kra/agent/kra/processReq?op=processReq&seqNum=113) I got all informations I need: Request 113
<https://localhost.localdomain:8443/kra/agent/kra/processReq?op=processReq&seqNum=113> Request Status:pending Type:recovery Created on:21/10/2015, 11:25:41 Updated by:kraagent Updated on:21/10/2015, 11:25:41 Recovery Information Key identifier:42 Recovery Initiating Agent:kraagent Recovery Approving Agents: Action Asynchronous Key Recovery: Grant <https://localhost.localdomain:8443/kra/agent/kra/grantAsyncRecovery?op=grantRecovery&reqID=113>
How to get Key Identiver from keyClient?