Esempio n. 1
0
        public const int Unauthorized = 6;                      // Request unauthorized

        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");
        }
Esempio n. 2
0
        public override bool Equals(
            object obj)
        {
            if (obj == this)
            {
                return(true);
            }

            BasicOcspResp other = obj as BasicOcspResp;

            if (other == null)
            {
                return(false);
            }

            return(resp.Equals(other.resp));
        }