// Parse response message
//
final PKIMessage respObject = PKIMessage.getInstance(new ASN1InputStream(new ByteArrayInputStream(retMsg)).readObject());
assertNotNull(respObject);
final PKIBody body = respObject.getBody();
final int tag = body.getTagNo();
assertEquals(exptag, tag);
final PKIStatusInfo info;
if (exptag == CmpPKIBodyConstants.ERRORMESSAGE) {
ErrorMsgContent c = body.getError();
assertNotNull(c);
info = c.getPKIStatus();
assertNotNull(info);
assertEquals(ResponseStatus.FAILURE.getIntValue(), info.getStatus().getValue().intValue());
int i = info.getFailInfo().intValue();
assertEquals(i, 1 << err);
} else if (exptag == CmpPKIBodyConstants.REVOCATIONRESPONSE) {
RevRepContent rrc = body.getRp();
assertNotNull(rrc);
info = rrc.getPKIStatusInfo(0);
assertNotNull(info);
assertEquals(ResponseStatus.FAILURE.getIntValue(), info.getStatus().getValue().intValue());
assertEquals(FailInfo.BAD_REQUEST.getAsBitString(), info.getFailInfo());
} else {
CertRepMessage c = null;
if (exptag == CmpPKIBodyConstants.INITIALIZATIONRESPONSE) {
c = body.getIp();
} else if (exptag == CmpPKIBodyConstants.CERTIFICATIONRESPONSE) {
c = body.getCp();
}
assertNotNull(c);
CertResponse resp = c.getResponse(0);
assertNotNull(resp);
assertEquals(resp.getCertReqId().getValue().intValue(), requestId);