From eca1b291846e68c64bcb71ff0567a9cdc80a50e6 Mon Sep 17 00:00:00 2001 From: Nate Barbettini Date: Tue, 28 Mar 2017 09:56:50 -0700 Subject: [PATCH] Target .NETFramework 3.5 --- src/JWT/Algorithms/RS256Algorithm.cs | 6 +++--- src/JWT/JWT.csproj | 6 +++--- src/JWT/JsonWebToken.cs | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/JWT/Algorithms/RS256Algorithm.cs b/src/JWT/Algorithms/RS256Algorithm.cs index bd726057b..b33177ee0 100644 --- a/src/JWT/Algorithms/RS256Algorithm.cs +++ b/src/JWT/Algorithms/RS256Algorithm.cs @@ -14,10 +14,10 @@ public RS256Algorithm(X509Certificate2 cert) public byte[] Sign(byte[] key, byte[] bytesToSign) { -#if NET45 - var rsa = (RSACryptoServiceProvider)_cert.PrivateKey; -#else +#if NETSTANDARD1_3 var rsa = (RSACryptoServiceProvider)_cert.GetRSAPrivateKey(); +#else + var rsa = (RSACryptoServiceProvider)_cert.PrivateKey; #endif var param = new CspParameters { diff --git a/src/JWT/JWT.csproj b/src/JWT/JWT.csproj index 5f734c16f..cc393971c 100644 --- a/src/JWT/JWT.csproj +++ b/src/JWT/JWT.csproj @@ -1,11 +1,11 @@  - net45;netstandard1.3 + net35;netstandard1.3 - + .NETFramework - NET45 + NET35 .NETStandard diff --git a/src/JWT/JsonWebToken.cs b/src/JWT/JsonWebToken.cs index 545132086..11dd26d6b 100644 --- a/src/JWT/JsonWebToken.cs +++ b/src/JWT/JsonWebToken.cs @@ -19,7 +19,7 @@ public static class JsonWebToken /// public static IJsonSerializer JsonSerializer = new JsonNetSerializer(); - private static readonly Lazy _jwtValidator = new Lazy(() => new JwtValidator(JsonSerializer, new UtcDateTimeProvider())); + private static readonly IJwtValidator _jwtValidator = new JwtValidator(JsonSerializer, new UtcDateTimeProvider()); private static readonly AlgorithmFactory _algorithmFactory = new AlgorithmFactory(); @@ -103,7 +103,7 @@ public static string Decode(string token, byte[] key, bool verify = true) { return new JwtDecoder( JsonSerializer, - _jwtValidator.Value) + _jwtValidator) .Decode(token, key, verify); } @@ -177,7 +177,7 @@ public static T DecodeToObject(string token, byte[] key, bool verify = true) /// The token has expired. public static void Verify(string payloadJson, string decodedCrypto, string decodedSignature) { - _jwtValidator.Value.Validate(payloadJson, decodedCrypto, decodedSignature); + _jwtValidator.Validate(payloadJson, decodedCrypto, decodedSignature); } /// From JWT spec