diff --git a/Jenkinsfile b/Jenkinsfile index 28f3775..4ccf97f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,7 +10,7 @@ pipeline { steps { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=631']) { + withEnv(['NEXT_BUILD_NUMBER=633']) { // env.versionNumber = VersionNumber(versionNumberString : '3.2.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '3.2.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.APP_NAME = 'SteamWareLib' diff --git a/SteamWareLib/utils.cs b/SteamWareLib/utils.cs index 1a491fd..ec951a6 100644 --- a/SteamWareLib/utils.cs +++ b/SteamWareLib/utils.cs @@ -1501,7 +1501,7 @@ namespace SteamWare public static string EncryptString(string Message, string Passphrase) { byte[] Results; - System.Text.UTF8Encoding UTF8 = new System.Text.UTF8Encoding(); + UTF8Encoding UTF8 = new UTF8Encoding(); // Step 1. We hash the passphrase using MD5 // We use the MD5 hash generator as the result is a 128 bit byte array @@ -1545,8 +1545,9 @@ namespace SteamWare /// public static string DecryptString(string Message, string Passphrase) { - byte[] Results; - System.Text.UTF8Encoding UTF8 = new System.Text.UTF8Encoding(); + string answ = Message; + byte[] Results = null; + UTF8Encoding UTF8 = new UTF8Encoding(); // Step 1. We hash the passphrase using MD5 // We use the MD5 hash generator as the result is a 128 bit byte array @@ -1564,23 +1565,31 @@ namespace SteamWare TDESAlgorithm.Padding = PaddingMode.PKCS7; // Step 4. Convert the input string to a byte[] - byte[] DataToDecrypt = Convert.FromBase64String(Message); - - // Step 5. Attempt to decrypt the string + byte[] DataToDecrypt = null; try { - ICryptoTransform Decryptor = TDESAlgorithm.CreateDecryptor(); - Results = Decryptor.TransformFinalBlock(DataToDecrypt, 0, DataToDecrypt.Length); + DataToDecrypt = Convert.FromBase64String(Message); } - finally + catch + { } + if (DataToDecrypt != null) { - // Clear the TripleDes and Hashprovider services of any sensitive information - TDESAlgorithm.Clear(); - HashProvider.Clear(); + // Step 5. Attempt to decrypt the string + try + { + ICryptoTransform Decryptor = TDESAlgorithm.CreateDecryptor(); + Results = Decryptor.TransformFinalBlock(DataToDecrypt, 0, DataToDecrypt.Length); + } + finally + { + // Clear the TripleDes and Hashprovider services of any sensitive information + TDESAlgorithm.Clear(); + HashProvider.Clear(); + } + // Step 6. Return the decrypted string in UTF8 format + answ = UTF8.GetString(Results); } - - // Step 6. Return the decrypted string in UTF8 format - return UTF8.GetString(Results); + return answ; } ///