Exemplo n.º 1
0
        public IJwsTool GenerateSigner()
        {
            if (KeyType.StartsWith("ES"))
            {
                var tool = new ACMESharp.Crypto.JOSE.Impl.ESJwsTool
                {
                    HashSize = int.Parse(KeyType.Substring(2))
                };
                tool.Init();
                tool.Import(KeyExport);
                return(tool);
            }

            if (KeyType.StartsWith("RS"))
            {
                var tool = new ACMESharp.Crypto.JOSE.Impl.RSJwsTool
                {
                    KeySize = int.Parse(KeyType.Substring(2))
                };
                tool.Init();
                tool.Import(KeyExport);
                return(tool);
            }

            throw new Exception($"Unknown or unsupported KeyType [{KeyType}]");
        }
Exemplo n.º 2
0
        public IJwsTool JwsTool()
        {
            if (KeyType.StartsWith("ES"))
            {
                var tool = new ESJwsTool
                {
                    HashSize = int.Parse(KeyType.Substring(2))
                };
                tool.Init();
                tool.Import(KeyExport);
                return(tool);
            }

            if (KeyType.StartsWith("RS"))
            {
                var tool = new RSJwsTool
                {
                    KeySize = int.Parse(KeyType.Substring(2))
                };
                tool.Init();
                tool.Import(KeyExport);
                return(tool);
            }

            throw new Exception($"Unknown or unsupported KeyType [{KeyType}]");
        }