/// <summary> /// Get the issuance state after the second message generation. /// </summary> /// <returns>The issuance state after the second message generation.</returns> public PostSecondMessageState ExportPostSecondMessageState() { if (state != State.Second) { throw new InvalidOperationException("GenerateSeondMessage must be called first"); } PostSecondMessageState psms = new PostSecondMessageState(); psms.TI = TI; psms.PI = PI; FieldZqElement[] alphaInverse = new FieldZqElement[numberOfTokens]; for (int i = 0; i < numberOfTokens; i++) { alphaInverse[i] = ukat[i].PrivateKey; } psms.AlphaInverse = alphaInverse; psms.Beta2 = beta2; psms.H = h; psms.SigmaZPrime = sigmaZPrime; psms.SigmaAPrime = sigmaAPrime; psms.SigmaBPrime = sigmaBPrime; psms.SigmaCPrime = sigmaCPrime; psms.IsDeviceProtected = isDeviceProtected; // we update the state so this object cannot be used by mistake to complete the issuance // (we don't want the same randomizers to be used twice on two issuer-provided messages) state = State.Tokens; return(psms); }
/// <summary> /// Constructs a new <code>Prover</code> instance. /// </summary> /// <param name="ip">The Issuer parameters.</param> /// <param name="psms">The post second message state.</param> public Prover(IssuerParameters ip, PostSecondMessageState psms) { psms.Validate(); this.ip = ip; this.numberOfTokens = psms.AlphaInverse.Length; this.TI = psms.TI; this.PI = psms.PI; this.isDeviceProtected = psms.IsDeviceProtected; this.beta2 = psms.Beta2; this.h = psms.H; this.sigmaZPrime = psms.SigmaZPrime; this.sigmaAPrime = psms.SigmaAPrime; this.sigmaBPrime = psms.SigmaBPrime; this.sigmaCPrime = psms.SigmaCPrime; ukat = new UProveKeyAndToken[numberOfTokens]; for (int i = 0; i < numberOfTokens; i++) { ukat[i] = new UProveKeyAndToken(); ukat[i].PrivateKey = psms.AlphaInverse[i]; } state = State.Second; }
/// <summary> /// Get the issuance state after the second message generation. /// </summary> /// <returns>The issuance state after the second message generation.</returns> public PostSecondMessageState ExportPostSecondMessageState() { if (state != State.Second) { throw new InvalidOperationException("GenerateSeondMessage must be called first"); } PostSecondMessageState psms = new PostSecondMessageState(); psms.TI = TI; psms.PI = PI; FieldZqElement[] alphaInverse = new FieldZqElement[numberOfTokens]; for (int i = 0; i < numberOfTokens; i++) { alphaInverse[i] = ukat[i].PrivateKey; } psms.AlphaInverse = alphaInverse; psms.Beta2 = beta2; psms.H = h; psms.SigmaZPrime = sigmaZPrime; psms.SigmaAPrime = sigmaAPrime; psms.SigmaBPrime = sigmaBPrime; psms.SigmaCPrime = sigmaCPrime; psms.IsDeviceProtected = isDeviceProtected; // we update the state so this object cannot be used by mistake to complete the issuance // (we don't want the same randomizers to be used twice on two issuer-provided messages) state = State.Tokens; return psms; }