コード例 #1
0
        private ITestResult Response()
        {
            try
            {
                OcspResponse resp = OcspResponse.GetInstance(
                    Asn1Object.FromByteArray(_response));
                ResponseBytes rBytes = ResponseBytes.GetInstance(resp.ResponseBytes);

                BasicOcspResponse bResp = BasicOcspResponse.GetInstance(
                    Asn1Object.FromByteArray(rBytes.Response.GetOctets()));

                resp = new OcspResponse(
                    resp.ResponseStatus,
                    new ResponseBytes(
                        rBytes.ResponseType,
                        new DerOctetString(bResp.GetEncoded())));

                if (!Arrays.AreEqual(resp.GetEncoded(), _response))
                {
                    return(new SimpleTestResult(false, Name + ": Ocsp response failed to re-encode"));
                }

                return(new SimpleTestResult(true, Name + ": Okay"));
            }
            catch (Exception e)
            {
                return(new SimpleTestResult(false, Name + ": failed response exception - " + e.ToString(), e));
            }
        }
コード例 #2
0
        public static CertificateStatus Parse(Stream input)
        {
            byte statusType = TlsUtilities.ReadUint8(input);

            if (statusType != 1)
            {
                throw new TlsFatalAlert(50);
            }
            return(new CertificateStatus(statusType, OcspResponse.GetInstance(TlsUtilities.ReadDerObject(TlsUtilities.ReadOpaque24(input)))));
        }
コード例 #3
0
ファイル: OcspResp.cs プロジェクト: UnforeseenOcean/Warmode
 private OcspResp(Asn1InputStream aIn)
 {
     try
     {
         this.resp = OcspResponse.GetInstance(aIn.ReadObject());
     }
     catch (Exception ex)
     {
         throw new IOException("malformed response: " + ex.Message, ex);
     }
 }
コード例 #4
0
 private OcspResp(Asn1InputStream aIn)
 {
     //IL_002b: Unknown result type (might be due to invalid IL or missing references)
     try
     {
         resp = OcspResponse.GetInstance(aIn.ReadObject());
     }
     catch (global::System.Exception ex)
     {
         throw new IOException("malformed response: " + ex.get_Message(), ex);
     }
 }
コード例 #5
0
    public static CertificateStatus Parse(Stream input)
    {
        byte b  = TlsUtilities.ReadUint8(input);
        byte b2 = b;

        if (b2 == 1)
        {
            byte[] encoding = TlsUtilities.ReadOpaque24(input);
            object instance = OcspResponse.GetInstance(TlsUtilities.ReadDerObject(encoding));
            return(new CertificateStatus(b, instance));
        }
        throw new TlsFatalAlert(50);
    }
コード例 #6
0
        public X509CertificateHelperTest()
        {
            newEid       = new X509Certificate2(@"files/eid79021802145-2027.crt");
            newEidIssuer = new X509Certificate2(@"files/Citizen201709.crt");
            OcspResponse ocspMsg = OcspResponse.GetInstance(Asn1Sequence.GetInstance(File.ReadAllBytes(@"files/eid79021802145-2027.ocsp-rsp")));

            newEidOcsp = BasicOcspResponse.GetInstance(Asn1Sequence.GetInstance(ocspMsg.ResponseBytes.Response.GetOctets()));

            oldEid       = new X509Certificate2(@"files/eid79021802145.crt");
            oldEidIssuer = new X509Certificate2(@"files/Citizen201204.crt");
            oldEidOcsp   = BasicOcspResponse.GetInstance(Asn1Sequence.GetInstance(File.ReadAllBytes(@"files/eid79021802145.ocsp")));
            oldEidOcsp2  = BasicOcspResponse.GetInstance(Asn1Sequence.GetInstance(File.ReadAllBytes(@"files/eid79021802145-2.ocsp")));
            oldEidCrl    = CertificateList.GetInstance(Asn1Sequence.GetInstance(File.ReadAllBytes(@"files/eid79021802145.crl")));
        }
コード例 #7
0
        /**
         * Parse a {@link CertificateStatus} from a {@link Stream}.
         *
         * @param input
         *            the {@link Stream} to parse from.
         * @return a {@link CertificateStatus} object.
         * @throws IOException
         */
        public static CertificateStatus Parse(Stream input)
        {
            byte   status_type = TlsUtilities.ReadUint8(input);
            object response;

            switch (status_type)
            {
            case CertificateStatusType.ocsp:
            {
                byte[] derEncoding = TlsUtilities.ReadOpaque24(input);
                response = OcspResponse.GetInstance(TlsUtilities.ReadDerObject(derEncoding));
                break;
            }

            default:
                throw new TlsFatalAlert(AlertDescription.decode_error);
            }

            return(new CertificateStatus(status_type, response));
        }