/// <summary> /// Decrypts the <paramref name="encryptedText"/> to a string, provided the original string was encoded with <see cref="T:System.Text.Encoding.UTF8"/>. /// </summary> /// <param name="cipher">The cipher.</param> /// <param name="encryptedText">The crypto text.</param> /// <returns>The decrypted text.</returns> /// <exception cref="System.ArgumentNullException">Thrown when <paramref name="cipher"/> is <see langword="null"/>.</exception> public static string DecryptString( this ICipher cipher, byte[] encryptedText) { if (cipher == null) { throw new ArgumentNullException(nameof(cipher)); } if (encryptedText == null) { return(null); } return(FromByteArray.ToString(cipher.Decrypt(encryptedText))); }