private ThirdIssuanceMessageInfo HandleThirdMessageInfo(Issuer issuer, SecondIssuanceMessage secondMessage)
    {
      ThirdIssuanceMessageInfo thirdMessageInfo = new ThirdIssuanceMessageInfo();
      thirdMessageInfo.ThirdMessage = issuer.GenerateThirdMessage(secondMessage);
      return thirdMessageInfo;

    }
        public void TestIssuerStateExport()
        {
            IssuerKeyAndParameters ikap;
            IssuerProtocolParameters ipp;
            ProverProtocolParameters ppp;
            StaticTestHelpers.GenerateTestIssuanceParameters("test issuer params", "test spec", 3, true, 6, out ikap, out ipp, out ppp);

            // generate test issuer parameters
            Issuer issuer = ipp.CreateIssuer();
            IssuerParameters ip = ikap.IssuerParameters;
            Prover prover = ppp.CreateProver();

            FirstIssuanceMessage msg1 = null;
            SecondIssuanceMessage msg2 = null;
            ThirdIssuanceMessage msg3 = null;

            msg1 = issuer.GenerateFirstMessage();
            PostFirstMessageState state = issuer.ExportPostFirstMessageState();
            string serializedState = ikap.IssuerParameters.Serialize(state);
            msg2 = prover.GenerateSecondMessage(msg1);
            
            // make sure the original issuer is unusable
            try
            {
                issuer.GenerateThirdMessage(msg2);
                Assert.Fail();
            }
            catch (Exception)
            {
                // expected
            }

            // complete the issuance with a new issuer instance
            Issuer issuer2 = new Issuer(ikap, ikap.IssuerParameters.Deserialize<PostFirstMessageState>(serializedState));
            msg3 = issuer2.GenerateThirdMessage(msg2);
            // make sure tokens are valid by completing the issuance
            prover.GenerateTokens(msg3);
        }