Beispiel #1
0
        public void SignStaticInvalidPduResponseVersionTest()
        {
            Ksi ksi = GetStaticKsi(Resources.KsiService_AggregationResponsePdu_RequestId_1584727637, 1584727637, null, PduVersion.v1);

            KsiServiceUnexpectedResponseFormatException ex = Assert.Throws <KsiServiceUnexpectedResponseFormatException>(delegate
            {
                ksi.Sign(new DataHash(Base16.Decode("0111A700B0C8066C47ECBA05ED37BC14DCADB238552D86C659342D1D7E87B8772D")));
            });

            Assert.That(ex.Message.StartsWith("Received PDU v2 response to PDU v1 request."), "Unexpected exception message: " + ex.Message);
        }
        public void ExtendStaticInvalidPduResponseVersionTest()
        {
            IKsiSignature signature = new KsiSignatureFactory().Create(File.ReadAllBytes(Path.Combine(TestSetup.LocalPath, Resources.KsiSignature_Ok)));
            Ksi           ksi       = GetStaticKsi(Resources.KsiService_ExtendResponsePdu_RequestId_1043101455, 1043101455, null, PduVersion.v1);

            KsiServiceUnexpectedResponseFormatException ex = Assert.Throws <KsiServiceUnexpectedResponseFormatException>(delegate
            {
                ksi.Extend(signature);
            });

            Assert.That(ex.Message.StartsWith("Received PDU v2 response to PDU v1 request."), "Unexpected exception message: " + ex.Message);
        }