Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            var response = "failure";
            var keyFile  = ConfigurationManager.AppSettings["keyFile"];

            if (args[0].Equals("pbk"))
            {
                if (Exists(keyFile))
                {
                    ga = new GA();
                    ga.DeserializeKey(ReadAllText(keyFile));
                }
                else
                {
                    var keyPair = Util.GenerateKeyPair();
                    ga = new GA(keyPair);
                    WriteAllText(keyFile, ga.SerializeKey());
                }
                response = ga.SerializeKey();
            }
            else if (args[0].Equals("sign"))
            {
                if (Exists(keyFile))
                {
                    ga = new GA();
                    ga.DeserializeKey(ReadAllText(keyFile));
                    response = Convert.ToBase64String(ga.Sign(Convert.FromBase64String(args[1])));
                }
            }
            else if (args[0].Equals("verify"))
            {
                if (Exists(keyFile))
                {
                    ga = new GA();
                    ga.DeserializeKey(ReadAllText(keyFile));
                    response = ga.Verify(Convert.FromBase64String(args[1]), Convert.FromBase64String(args[2])).ToString();
                }
            }
            Console.WriteLine(response);
        }
Ejemplo n.º 2
0
 public Genome(IGA parent)
 {
     this.Parent = parent;
 }
Ejemplo n.º 3
0
 public SpeciatedGenome(IGA parent) : base(parent)
 {
 }