private ASN1Encodable extractGeneralRepContent(PKIMessage response, String expectedType) throws Exception { PKIBody respBody = response.getBody(); int bodyType = respBody.getType(); if (PKIBody.TYPE_ERROR == bodyType) { ErrorMsgContent content = ErrorMsgContent.getInstance(respBody.getContent()); throw new Exception("Server returned PKIStatus: " + buildText(content.getPKIStatusInfo())); } else if (PKIBody.TYPE_GEN_REP != bodyType) { throw new Exception(String.format("unknown PKI body type %s instead the expected [%s, %s]", bodyType, PKIBody.TYPE_GEN_REP, PKIBody.TYPE_ERROR)); } GenRepContent genRep = GenRepContent.getInstance(respBody.getContent()); InfoTypeAndValue[] itvs = genRep.toInfoTypeAndValueArray(); InfoTypeAndValue itv = null; if (itvs != null && itvs.length > 0) { for (InfoTypeAndValue entry : itvs) { if (expectedType.equals(entry.getInfoType().getId())) { itv = entry; break; } } } if (itv == null) { throw new Exception("the response does not contain InfoTypeAndValue " + expectedType); } return itv.getInfoValue(); } // method extractGeneralRepContent
public static GenRepContent getInstance(Object o) { if (o instanceof GenRepContent) { return (GenRepContent)o; } if (o != null) { return new GenRepContent(ASN1Sequence.getInstance(o)); } return null; }
return GenMsgContent.getInstance(o); case TYPE_GEN_REP: return GenRepContent.getInstance(o); case TYPE_ERROR: return ErrorMsgContent.getInstance(o);
return GenMsgContent.getInstance(o); case TYPE_GEN_REP: return GenRepContent.getInstance(o); case TYPE_ERROR: return ErrorMsgContent.getInstance(o);
GenRepContent genRep = GenRepContent.getInstance(respBody.getContent()); InfoTypeAndValue[] itvs = genRep.toInfoTypeAndValueArray(); InfoTypeAndValue itv = null; if (itvs != null && itvs.length > 0) {
public static GenRepContent getInstance(Object o) { if (o instanceof GenRepContent) { return (GenRepContent)o; } if (o != null) { return new GenRepContent(ASN1Sequence.getInstance(o)); } return null; }
? CMPObjectIdentifiers.it_currentCRL : ObjectIdentifiers.id_xipki_cmp_cmpGenmsg; GenRepContent genRep = GenRepContent.getInstance(respBody.getContent()); InfoTypeAndValue[] itvs = genRep.toInfoTypeAndValueArray(); InfoTypeAndValue itv = null; if (itvs != null && itvs.length > 0) {
GenRepContent genRepContent = new GenRepContent(itvResp); return new PKIBody(PKIBody.TYPE_GEN_REP, genRepContent); } catch (OperationException ex) {