diff --git a/Encrypter/Extensions.cs b/Encrypter/Extensions.cs index 3b1ea38..ce47e47 100644 --- a/Encrypter/Extensions.cs +++ b/Encrypter/Extensions.cs @@ -17,10 +17,11 @@ namespace Encrypter /// /// This UTF8 encoded string to encrypt. /// The password. Must consists of 6 chars or more. + /// The number of iterations to derive the key. Should not be adjusted. The default is secure for the current time. /// The base64 encoded and encrypted string. The string is ASCII encoding. - public static async Task Encrypt(this string data, string password) + public static async Task Encrypt(this string data, string password, int iterations = CryptoProcessor.ITERATIONS_YEAR_2020) { - return await CryptoProcessor.EncryptString(data, password); + return await CryptoProcessor.EncryptString(data, password, iterations); } /// @@ -35,9 +36,10 @@ namespace Encrypter /// The desired input stream. The encryption starts at the current position. /// The desired output stream. The encrypted data gets written to the current position. /// The encryption password. - public static async Task Encrypt(this Stream inputStream, Stream outputStream, string password) + /// The number of iterations to derive the key. Should not be adjusted. The default is secure for the current time. + public static async Task Encrypt(this Stream inputStream, Stream outputStream, string password, int iterations = CryptoProcessor.ITERATIONS_YEAR_2020) { - await CryptoProcessor.EncryptStream(inputStream, outputStream, password); + await CryptoProcessor.EncryptStream(inputStream, outputStream, password, iterations); } /// @@ -49,10 +51,11 @@ namespace Encrypter /// /// The base64 encoded and AES encrypted string. This string must be ASCII encoded. /// The password. Must consists of 6 chars or more. + /// The number of iterations to derive the key. Should not be adjusted. The default is secure for the current time. /// The decrypted UTF8 encoded string. - public static async Task Decrypt(this string data, string password) + public static async Task Decrypt(this string data, string password, int iterations = CryptoProcessor.ITERATIONS_YEAR_2020) { - return await CryptoProcessor.DecryptString(data, password); + return await CryptoProcessor.DecryptString(data, password, iterations); } /// @@ -67,9 +70,10 @@ namespace Encrypter /// The desired input stream. The decryption starts at the current position. /// The desired output stream. The decrypted data gets written to the current position. /// The encryption password. - public static async Task Decrypt(this Stream inputStream, Stream outputStream, string password) + /// The number of iterations to derive the key. Should not be adjusted. The default is secure for the current time. + public static async Task Decrypt(this Stream inputStream, Stream outputStream, string password, int iterations = CryptoProcessor.ITERATIONS_YEAR_2020) { - await CryptoProcessor.DecryptStream(inputStream, outputStream, password); + await CryptoProcessor.DecryptStream(inputStream, outputStream, password, iterations); } } }