public void TestEncode() { var expected = codedTestString; var actual = new Base64URL().Encode(uncodedTestString); Assert.Equal(expected, actual); }
//public JwtAuthenticationService() //{ // _base64 = new Base64URL(); // _crypter = new TCrypter(); // _jsonSerialization = new TJsonSerialization(); // _jwtFactory = new JwtFactory(_base64, _jsonSerialization, _crypter); //} public JwtAuthenticationService(TSignaturer s, TJsonSerialization j) { _base64 = new Base64URL(); _jwtFactory = new JwtFactory(_base64, _jsonSerialization, _signaturer); _signaturer = s; _jsonSerialization = j; }
public void TestDecode() { var expected = uncodedTestString; var res = Base64UrlEncoder.Decode(codedTestString); Assert.Equal(uncodedTestString, res); var actual = new Base64URL().Decode(codedTestString); Assert.Equal(expected, actual); }
/// <summary> /// スタートアップポイント /// </summary> /// <param name="args">コマンドライン引数</param> public static void Main(string[] args) { if (args.Length == 2 && args[0].ToLower() == "encode") { var value = Base64URL.Encode(args[1]); Console.Write(value); Environment.Exit(0); return; } else if (args.Length == 2 && args[0].ToLower() == "decode") { var value = Base64URL.Encode(args[1]); Console.Write(value); Environment.Exit(0); return; } int index; if (args.Length == 0 || !File.Exists(args[0])) { Environment.Exit(-1); } else if (args.Length == 1) { OutputList(args[0]); } else if (int.TryParse(args[1], out index)) { OutputImage(args[0], index); } else { OutputImage(args[0], args[1]); } Environment.Exit(0); }
/// <summary> /// 指定されたBase64Url文字列から元の文字列を返す /// </summary> /// <param name="value"></param> private static string DecodeBase64Url(string value) { return(Base64URL.Decode(value)); }