public OcspResp Generate(
int status,
object response)
{
if (response == null)
{
return new OcspResp(new OcspResponse(new OcspResponseStatus(status),null));
}
if (response is BasicOcspResp)
{
BasicOcspResp r = (BasicOcspResp)response;
Asn1OctetString octs;
try
{
octs = new DerOctetString(r.GetEncoded());
}
catch (Exception e)
{
throw new OcspException("can't encode object.", e);
}
ResponseBytes rb = new ResponseBytes(
OcspObjectIdentifiers.PkixOcspBasic, octs);
return new OcspResp(new OcspResponse(
new OcspResponseStatus(status), rb));
}
throw new OcspException("unknown response object");
}
}