/// <summary> /// Decrypts the specified instance byte array. /// </summary> /// <param name="instanceArray">Instance byte array submitted for decryption.</param> /// <returns>Object if decryption was successful; null for otherwise.</returns> public static object Decrypt(byte[] instanceArray) { if (instanceArray == null || instanceArray.LongLength == 0) { Logger.Warn("Unable to decrypt null or empty byte array!"); return(null); } if (Logger.IsDebugEnabled) { ASCIIEncoding encoding = new ASCIIEncoding(); Logger.DebugFormat("Decrypting instance: {0}", encoding.GetString(instanceArray)); } byte[] decryptedInstance; try { decryptedInstance = SimpleEncryption.Decrypt(instanceArray, PassPhrase); } catch (Exception exception) { Logger.Error("Problem encountered decrypting the byte array!", exception); return(null); } return(ObjectUtil.ConvertToObject(decryptedInstance)); }
/// <summary> /// Decrypts the specified to decrypt. /// </summary> /// <param name="toDecrypt">To decrypt.</param> /// <returns></returns> public static string Decrypt(string toDecrypt) { if (string.IsNullOrEmpty(toDecrypt)) { Logger.Warn("Unable to decrypt null or empty string instance"); return(null); } return(SimpleEncryption.Decrypt(toDecrypt, PassPhrase)); }