private void generateSerialNumber() { //Generating serial numbers (SL) serialNumberList = new List <BigInteger>(); serialNumberList = SerialNumberGenerator.generateListOfSerialNumber(this.numberOfVoters, NetworkLib.Constants.NUMBER_OF_BITS_SL); Utils.Logs.addLog("EA", NetworkLib.Constants.SERIAL_NUMBER_GEN_SUCCESSFULLY, true, NetworkLib.Constants.LOG_INFO, true); }
private void generateTokens() { //preparing Big Integers for RSA blind signature (token have to fulfil requirments) this.tokensList = new List <List <BigInteger> >(); this.exponentsList = new List <List <BigInteger> >(); this.signatureFactor = new List <List <BigInteger> >(); for (int i = 0; i < this.numberOfVoters; i++) { // we use the same method like to generate serial number, there is another random generator used inside this method List <AsymmetricCipherKeyPair> preToken = new List <AsymmetricCipherKeyPair>(SerialNumberGenerator.generatePreTokens(4, NetworkLib.Constants.NUMBER_OF_BITS_TOKEN)); List <BigInteger> tokens = new List <BigInteger>(); List <BigInteger> exps = new List <BigInteger>(); List <BigInteger> signFactor = new List <BigInteger>(); foreach (AsymmetricCipherKeyPair token in preToken) { RsaKeyParameters publicKey = (RsaKeyParameters)token.Public; RsaKeyParameters privKey = (RsaKeyParameters)token.Private; tokens.Add(publicKey.Modulus); exps.Add(publicKey.Exponent); signFactor.Add(privKey.Exponent); } this.tokensList.Add(tokens); this.exponentsList.Add(exps); this.signatureFactor.Add(signFactor); } Utils.Logs.addLog("EA", NetworkLib.Constants.TOKENS_GENERATED_SUCCESSFULLY, true, NetworkLib.Constants.LOG_INFO, true); connectSerialNumberAndTokens(); }
private void generatePermutationTokens() { this.permutationTokensList = new List <BigInteger>(); this.permutationExponentsList = new List <BigInteger>(); for (int i = 0; i < this.numberOfVoters; i++) { // we use the same method like to generate serial number, there is another random generator used inside this method List <AsymmetricCipherKeyPair> preToken = new List <AsymmetricCipherKeyPair>(SerialNumberGenerator.generatePreTokens(1, NetworkLib.Constants.NUMBER_OF_BITS_TOKEN)); RsaKeyParameters publicKey = (RsaKeyParameters)preToken[0].Public; RsaKeyParameters privKey = (RsaKeyParameters)preToken[0].Private; permutationTokensList.Add(publicKey.Modulus); permutationExponentsList.Add(publicKey.Exponent); } Console.WriteLine("Permutation tokens generated"); }