示例#1
0
        public ActionResult Index(FormCollection form)
        {
            Encoding encoding = new Base32Encoding();

            ViewBag.Encoded = encoding.GetString(Encoding.UTF8.GetBytes(form["plainText"]));

            return(View());
        }
示例#2
0
        private static Uri GetUri(byte[] secret)
        {
            Encoding encoding = new Base32Encoding();

            UriBuilder builder = new UriBuilder();

            builder.Host   = "totp";
            builder.Path   = "testme";
            builder.Query  = "secret=" + encoding.GetString(secret);
            builder.Scheme = "otpauth";

            return(builder.Uri);
        }