Example #1
0
        static void Main(string[] args)
        {
            string script = null;

            LogManager.Instance = new FileLogManager(Console.Out);

            foreach (string arg in args)
            {
                if (arg[0] == '-')
                {
                    if (arg.StartsWith("--script="))
                    {
                        script = arg.Substring(9);
                    }
                }
                else
                {
                }
            }

            FillDispatchTable(_dispatchTable);
#if DO_ACE
            AceAuthz.AddCommands(_dispatchTable);

            //  Setup plain OAuth
            AceAuthzHandler = new AceAuthz();
#endif
#if DO_RD
            ResourceDirectory.AddCommands(_dispatchTable);
#endif



            if (script != null)
            {
                TextReader x = new StreamReader(script);
                RunScript(x);
                x.Dispose();
            }


            RunScript(Console.In);
        }
Example #2
0
        static void Main(string[] args)
        {
            Options options = null;
            ParserResult <Options> optionResult = CommandLine.Parser.Default.ParseArguments <Options>(args)
                                                  .WithParsed(o => { options = o; })
                                                  .WithNotParsed(o => {
                Console.WriteLine("Invalid command line");
                Console.WriteLine(o.ToString());
                Environment.Exit(1);
            });


            Console.Title = options.Title;

#if false
            {
                //  Generate a pair of CWT messages signed by a third key.

                OneKey clientKey = OneKey.GenerateKey(AlgorithmValues.ECDSA_256, GeneralValues.KeyType_EC);
                OneKey serverKey = OneKey.GenerateKey(AlgorithmValues.ECDSA_256, GeneralValues.KeyType_EC);
                OneKey caKey     = OneKey.GenerateKey(AlgorithmValues.ECDSA_256, GeneralValues.KeyType_EC);

                CWT clientCwt = new CWT();
                clientCwt.Cnf        = new Confirmation(clientKey.PublicKey());
                clientCwt.SigningKey = caKey;
                CBORObject clientCwtCbor  = clientCwt.EncodeToCBOR();
                string     clientCwtStr   = clientCwtCbor.ToString();
                byte[]     clientCwtBytes = clientCwt.EncodeToBytes();

                CWT serverCwt = new CWT()
                {
                    Cnf        = new Confirmation(serverKey),
                    SigningKey = caKey
                };
                CBORObject serverCwtCbor  = serverCwt.EncodeToCBOR();
                string     serverCwtStr   = serverCwtCbor.ToString();
                byte[]     serverCwtBytes = serverCwt.EncodeToBytes();

                string caStr = caKey.EncodeToCBORObject().ToString();
            }
#endif

            LogManager.Instance = new FileLogManager(Console.Out);


            FillDispatchTable(dispatchTable);
            Oscore.Register(dispatchTable);
#if DEV_VERSION
            Groups.FillDispatchTable(dispatchTable);
#endif

#if DO_ACE
            AceAuthz.AddCommands(dispatchTable);

            //  Setup plain OAuth
            AceAuthzHandler = new AceAuthz();
#endif
#if DO_RD
            ResourceDirectory.AddCommands(dispatchTable);
#endif



            if (options.Script != null)
            {
                TextReader x = new StreamReader(options.Script);
                RunScript(x);
                x.Dispose();
            }


            RunScript(Console.In);
        }