diff --git a/ILovePDF/ILovePDF/Core/RequestHelper.cs b/ILovePDF/ILovePDF/Core/RequestHelper.cs index 30cfd5a..32a25ee 100644 --- a/ILovePDF/ILovePDF/Core/RequestHelper.cs +++ b/ILovePDF/ILovePDF/Core/RequestHelper.cs @@ -1,7 +1,4 @@ -using JWT; -using JWT.Algorithms; -using JWT.Serializers; -using LovePdf.Model.Enums; +using LovePdf.Model.Enums; using LovePdf.Model.Exception; using LovePdf.Model.TaskParams; using Newtonsoft.Json; @@ -16,13 +13,15 @@ using System.Net.Http; using System.Net.Http.Headers; using System.Security.Authentication; +using System.Text; using System.Threading.Tasks; +using Jose; namespace LovePdf.Core { internal class RequestHelper { - private string _privateKey; + private byte[] _privateKey; private string _publicKey; private readonly short _jwtDelay = 5400; @@ -571,7 +570,7 @@ private static List ToChunks(Stream fileStream) public RequestHelper SetKeys(string privateKey, string publicKey) { - _privateKey = privateKey; + _privateKey = Encoding.UTF8.GetBytes(privateKey); _publicKey = publicKey; return this; } @@ -620,20 +619,10 @@ private bool IsExpiredGwt() { try { - IJsonSerializer serializer = new JsonNetSerializer(); - IDateTimeProvider provider = new UtcDateTimeProvider(); - IJwtValidator validator = new JwtValidator(serializer, provider); - IBase64UrlEncoder urlEncoder = new JwtBase64UrlEncoder(); - IJwtDecoder decoder = new JwtDecoder(serializer, validator, urlEncoder); - - var json = decoder.Decode(Gwt, _privateKey, verify: true); + JWT.Decode(Gwt, _privateKey, JwsAlgorithm.HS256); return false; } - catch (TokenExpiredException) - { - return true; - } - catch (SignatureVerificationException) + catch (Exception) { return true; } @@ -665,12 +654,7 @@ private string GetJwt() payLoad.Add("file_encryption_key", EncryptKey); } - IJwtAlgorithm algorithm = new HMACSHA256Algorithm(); - IJsonSerializer serializer = new JsonNetSerializer(); - IBase64UrlEncoder urlEncoder = new JwtBase64UrlEncoder(); - IJwtEncoder encoder = new JwtEncoder(algorithm, serializer, urlEncoder); - - var token = encoder.Encode(payLoad, _privateKey); + var token = JWT.Encode(payLoad, _privateKey, JwsAlgorithm.HS256); return token; } diff --git a/ILovePDF/ILovePDF/ILovePDF.csproj b/ILovePDF/ILovePDF/ILovePDF.csproj index 4d7f61f..ac88034 100644 --- a/ILovePDF/ILovePDF/ILovePDF.csproj +++ b/ILovePDF/ILovePDF/ILovePDF.csproj @@ -1,150 +1,55 @@ - - - + + Release - AnyCPU - {E857560B-A766-4BF5-A601-A5503CDBC825} - Library - Properties LovePdf ILovePdf - v4.6 - 512 - + net45;net46 + iLovePDF + iLovePDF + Develop and automate PDF processing tasks like Compress PDF, Merge PDF, Split PDF, convert Office to PDF, PDF to JPG, Images to PDF, add Page Numbers, Rotate PDF, Unlock PDF, stamp a Watermark and Repair PDF. Each one with several settings to get your desired results. + Copyright 2017 + 1.2.1.0 + 1.2.1.0 + 1.2.1.0 + bin\$(Configuration)\ + Mario Martinez, Alexandra Kyluk, Aleksey Sidorov, Egor Krivoshapka + ILove_PDF + https://opensource.org/licenses/MIT + https://github.com/ilovepdf/ilovepdf-net + .Net Compliance, bug fixes + ILOVEPDF Merge PDF Split convert Office to pdf PDf JPG Images unlock Pdf repair rotate pdf + - true full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - bin\Debug\ILovePdf.xml + bin\$(Configuration)\ILovePdf.xml AllRules.ruleset true + pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - false + iLovePdf.snk + + + + + + - - ..\packages\JWT.4.0.0\lib\net46\JWT.dll - - - ..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - + \ No newline at end of file diff --git a/ILovePDF/ILovePDF/ILovePDF.nuspec b/ILovePDF/ILovePDF/ILovePDF.nuspec deleted file mode 100644 index fff5f58..0000000 --- a/ILovePDF/ILovePDF/ILovePDF.nuspec +++ /dev/null @@ -1,18 +0,0 @@ - - - - ILove_PDF - $version$ - Mario Martinez, Alexandra Kyluk, Aleksey Sidorov, Egor Krivoshapka - mariomash - https://opensource.org/licenses/MIT - https://github.com/ilovepdf/ilovepdf-net - false - Develop and automate PDF processing tasks like Compress PDF, Merge PDF, Split PDF, convert Office to PDF, PDF to JPG, Images to PDF, add Page Numbers, Rotate PDF, Unlock PDF, stamp a Watermark and Repair PDF. Each one with several settings to get your desired results. - .Net Compliance, bug fixes - Copyright 2017 - ILOVEPDF Merge PDF Split convert Office to pdf PDf JPG Images unlock Pdf repair rotate pdf - - - - \ No newline at end of file diff --git a/ILovePDF/ILovePDF/Properties/AssemblyInfo.cs b/ILovePDF/ILovePDF/Properties/AssemblyInfo.cs index dbe6ffe..fb17780 100644 --- a/ILovePDF/ILovePDF/Properties/AssemblyInfo.cs +++ b/ILovePDF/ILovePDF/Properties/AssemblyInfo.cs @@ -2,18 +2,6 @@ using System.Reflection; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("iLovePDF")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("iLovePDF")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. @@ -22,17 +10,4 @@ // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("e857560b-a766-4bf5-a601-a5503cdbc825")] -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.2.1.0")] -[assembly: AssemblyFileVersion("1.2.1.0")] - [assembly: CLSCompliant(true)] \ No newline at end of file diff --git a/ILovePDF/ILovePDF/packages.config b/ILovePDF/ILovePDF/packages.config deleted file mode 100644 index b994c41..0000000 --- a/ILovePDF/ILovePDF/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/ILovePDF/Samples/Properties/AssemblyInfo.cs b/ILovePDF/Samples/Properties/AssemblyInfo.cs index 1c7737d..c687b71 100644 --- a/ILovePDF/Samples/Properties/AssemblyInfo.cs +++ b/ILovePDF/Samples/Properties/AssemblyInfo.cs @@ -1,18 +1,6 @@ using System.Reflection; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Samples")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Samples")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. @@ -20,16 +8,3 @@ // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("652b4674-62cf-46a2-9fdf-f1d342fc79a5")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ILovePDF/Samples/Samples.csproj b/ILovePDF/Samples/Samples.csproj index 87e0137..143e3bb 100644 --- a/ILovePDF/Samples/Samples.csproj +++ b/ILovePDF/Samples/Samples.csproj @@ -1,80 +1,28 @@ - - - + - Debug - AnyCPU {652B4674-62CF-46A2-9FDF-F1D342FC79A5} - Library - Properties - Samples - Samples - v4.6 - 512 - + net46 + Samples + Samples + Copyright © 2017 + Samples + Samples + Copyright © 2017 + false + bin\$(Configuration)\ - true full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - + - - - {E857560B-A766-4BF5-A601-A5503CDBC825} - iLovePDF - - - - - - - \ No newline at end of file diff --git a/ILovePDF/Tests/Properties/AssemblyInfo.cs b/ILovePDF/Tests/Properties/AssemblyInfo.cs index 15a6961..542b722 100644 --- a/ILovePDF/Tests/Properties/AssemblyInfo.cs +++ b/ILovePDF/Tests/Properties/AssemblyInfo.cs @@ -1,19 +1,6 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.InteropServices; -[assembly: AssemblyTitle("Tests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Tests")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - [assembly: ComVisible(false)] [assembly: Guid("76837053-65fd-43f0-b69d-1c6965b302e2")] - -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ILovePDF/Tests/Tests.csproj b/ILovePDF/Tests/Tests.csproj index bf181d8..b5d32b0 100644 --- a/ILovePDF/Tests/Tests.csproj +++ b/ILovePDF/Tests/Tests.csproj @@ -1,76 +1,37 @@ - - - + - Debug - AnyCPU {76837053-65FD-43F0-B69D-1C6965B302E2} - Library - Properties - Tests - Tests - v4.6 - 512 + net46 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 15.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages False UnitTest - - - + Tests + Tests + Copyright © 2017 + Tests + Tests + Copyright © 2017 + false + bin\$(Configuration)\ - true full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 pdbonly - true - bin\Release\ - TRACE - prompt - 4 + - - ..\packages\MSTest.TestFramework.1.1.11\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll - - - ..\packages\MSTest.TestFramework.1.1.11\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - + @@ -118,24 +79,8 @@ PreserveNewest - - - - {e857560b-a766-4bf5-a601-a5503cdbc825} - iLovePDF - + - - - - - - Este proyecto hace referencia a los paquetes NuGet que faltan en este equipo. Use la restauración de paquetes NuGet para descargarlos. Para obtener más información, consulte http://go.microsoft.com/fwlink/?LinkID=322105. El archivo que falta es {0}. - - - - - \ No newline at end of file diff --git a/ILovePDF/Tests/packages.config b/ILovePDF/Tests/packages.config deleted file mode 100644 index 1ab7218..0000000 --- a/ILovePDF/Tests/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file