diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6a8c568f..43a8ad15 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,9 +4,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
-## [next] -
+## [Unreleased] -
+
+### Changed
+
- Multiple functions, such as `generate_key` and `hash_password`, now return a `Result` due to the `rand` library upgrade.
+### Removed
+
+- Removed `EncryptWithKeyAsString`, `EncryptWithPasswordAsString`, `DecryptWithKeyAsString`, `DecryptWithPasswordAsString`,
+ `GenerateAPIKey`.
+
## [0.9.2] - 2025-01-20
- Online encryption feature
diff --git a/wrappers/csharp/Examples.md b/wrappers/csharp/Examples.md
deleted file mode 100644
index 70c33f82..00000000
--- a/wrappers/csharp/Examples.md
+++ /dev/null
@@ -1,13 +0,0 @@
-# Encrypt
-###
-
-```csharp
- string encrypt = Devolutions.Cryptography.Managed.EncryptWithPasswordAsString("secretdata", "secretpass");
-```
-
-# Decrypt
-###
-
-```csharp
- string decrypt = Devolutions.Cryptography.Managed.DecryptWithPasswordAsString(encrypt, "secretpass");
-```
diff --git a/wrappers/csharp/src/Managed.cs b/wrappers/csharp/src/Managed.cs
index c2aafc95..9477c910 100644
--- a/wrappers/csharp/src/Managed.cs
+++ b/wrappers/csharp/src/Managed.cs
@@ -86,20 +86,6 @@ public static Argon2Parameters GetDefaultArgon2Parameters()
return Argon2Parameters.FromByteArray(rawParameters);
}
- ///
- /// Encrypts the data (which will be encoded into a UTF8 byte array) with the provided key.
- ///
- /// The data to encrypt.
- /// The key to use for encryption.
- /// Additional authenticated data. (Optional).
- /// The cipher version to use. (Latest is recommended).
- /// Returns the encryption result as a base 64 encoded string.
- [Obsolete("This method has been deprecated. Use EncryptWithKeyAsBase64String instead.")]
- public static string EncryptWithKeyAsString(string data, byte[] key, byte[] aad = null, CipherTextVersion version = CIPHERTEXT_VERSION)
- {
- return EncryptWithKeyAsBase64String(data, key, aad, version);
- }
-
///
/// Encrypts the data (which will be encoded into a UTF8 byte array) with the provided key.
///
@@ -315,20 +301,6 @@ public static byte[] DecryptAsymmetric(byte[] data, byte[] privateKey, byte[] aa
return result;
}
- ///
- /// Encrypts the data with the provided key.
- ///
- /// The data to encrypt.
- /// The key to use for encryption.
- /// Additional authenticated data. (Optional).
- /// The cipher version to use. (Latest is recommended).
- /// Returns the encryption result as a base 64 encoded string.
- [Obsolete("This method has been deprecated. Use EncryptWithKeyAsBase64String instead.")]
- public static string EncryptWithKeyAsString(byte[] data, byte[] key, byte[] aad = null, CipherTextVersion version = CIPHERTEXT_VERSION)
- {
- return EncryptWithKeyAsBase64String(data, key, aad, version);
- }
-
///
/// Encrypts the data with the provided key.
///
@@ -359,21 +331,6 @@ public static byte[] EncryptWithKey(byte[] data, byte[] key, byte[] aad = null,
return cipher;
}
- ///
- /// Encrypts the data with the provided password (which will be encoded into a UTF8 byte array and derived).
- ///
- /// The data to encrypt.
- /// The password to use for encryption.
- /// The number of iterations used to derive the password. 10 000 Recommended by NIST.
- /// Additional authenticated data. (Optional).
- /// The cipher version to use. (Latest is recommended).
- /// Returns the encryption result as a base 64 encoded string.
- [Obsolete("This method has been deprecated. Use EncryptWithPasswordAsBase64String instead.")]
- public static string EncryptWithPasswordAsString(byte[] data, string password, uint iterations = 10000, byte[] aad = null, CipherTextVersion cipherTextVersion = CIPHERTEXT_VERSION)
- {
- return EncryptWithPasswordAsBase64String(data, password, iterations, aad, cipherTextVersion);
- }
-
///
/// Encrypts the data with the provided password (which will be encoded into a UTF8 byte array and derived).
///
@@ -743,21 +700,6 @@ public static byte[] EncryptAsymmetric(byte[] data, byte[] publicKey, byte[] aad
return result;
}
- ///
- /// Encrypts the data (which will be encoded into a UTF8 byte array) with the provided password (which will be encoded into a UTF8 byte array and derived).
- ///
- /// The data to encrypt.
- /// The password to use for encryption.
- /// Additional authenticated data. (Optional).
- /// The number of iterations used to derive the password. 10 000 Recommended by NIST.
- /// The cipher version to use. (Latest is recommended).
- /// Returns the encryption result as a base 64 encoded string.
- [Obsolete("This method has been deprecated. Use EncryptWithPasswordAsBase64String instead.")]
- public static string EncryptWithPasswordAsString(string data, string password, byte[] aad = null, uint iterations = 10000, CipherTextVersion cipherTextVersion = CIPHERTEXT_VERSION)
- {
- return EncryptWithPasswordAsBase64String(data, password, iterations, aad, cipherTextVersion);
- }
-
///
/// Encrypts the data (which will be encoded into a UTF8 byte array) with the provided password (which will be encoded into a UTF8 byte array and derived).
///
@@ -890,19 +832,6 @@ public static byte[] EncryptWithPassword(string data, string password, uint iter
return cipher;
}
- ///
- /// Decrypts the base64 string with the provided key.
- ///
- /// The base 64 string to decrypt.
- /// The key to use for decryption.
- /// Additional authenticated data. (Optional).
- /// Returns the decryption result as a UTF8 encoded string.
- [Obsolete("This method has been deprecated. Use DecryptWithKeyAsUtf8String instead.")]
- public static string DecryptWithKeyAsString(string b64data, byte[] key, byte[] aad = null)
- {
- return DecryptWithKeyAsUtf8String(b64data, key, aad);
- }
-
///
/// Decrypts the base64 string with the provided key.
///
@@ -933,19 +862,6 @@ public static byte[] DecryptWithKey(string b64data, byte[] key, byte[] aad = nul
return result;
}
- ///
- /// Decrypts the data with the provided key.
- ///
- /// The data to decrypt.
- /// The key to use for decryption.
- /// Additional authenticated data. (Optional).
- /// Returns the decryption result as a UTF8 encoded string.
- [Obsolete("This method has been deprecated. Use DecryptWithKeyAsUtf8String instead.")]
- public static string DecryptWithKeyAsString(byte[] data, byte[] key, byte[] aad = null)
- {
- return DecryptWithKeyAsUtf8String(data, key, aad);
- }
-
///
/// Decrypts the data with the provided key.
///
@@ -976,20 +892,6 @@ public static byte[] DecryptWithKey(byte[] data, byte[] key, byte[] aad = null,
return result;
}
- ///
- /// Decrypts the data with the provided password (which will be encoded into a UTF8 byte array and derived).
- ///
- /// The data to decrypt.
- /// The password to use for decryption.
- /// The number of iterations used to derive the password.
- /// Additional authenticated data. (Optional).
- /// Returns the decryption result as a UTF8 encoded string.
- [Obsolete("This method has been deprecated. Use DecryptWithPasswordAsUtf8String instead.")]
- public static string DecryptWithPasswordAsString(byte[] data, string password, uint iterations = 10000, byte[] aad = null)
- {
- return DecryptWithPasswordAsUtf8String(data, password, iterations, aad);
- }
-
///
/// Decrypts the data with the provided password (which will be encoded into a UTF8 byte array and derived).
///
@@ -1040,20 +942,6 @@ public static string DecryptWithPasswordAsUtf8String(byte[] data, string passwor
return Utils.ByteArrayToUtf8String(result);
}
- ///
- /// Decrypts the base 64 data (which will be decoded to the original data) with the provided password (which will be encoded into a UTF8 byte array and derived).
- ///
- /// The data to decrypt.
- /// The password to use for decryption.
- /// The number of iterations used to derive the password.
- /// Additional authenticated data. (Optional).
- /// Returns the decryption result as a UTF8 encoded string.
- [Obsolete("This method has been deprecated. Use DecryptWithPasswordAsUtf8String instead.")]
- public static string DecryptWithPasswordAsString(string b64data, string password, uint iterations = 10000, byte[] aad = null)
- {
- return DecryptWithPasswordAsUtf8String(b64data, password, iterations, aad);
- }
-
///
/// Join multiple shares to regenerate a shared secret.
///
@@ -1301,23 +1189,6 @@ public static byte[] DecryptWithPassword(string b64data, string password, uint i
return result;
}
- ///
- /// Generates an API key.
- ///
- /// An API key formated as a Guid.
- [Obsolete("This method has been deprecated. Use Managed.GenerateKey instead.")]
- public static Guid GenerateAPIKey()
- {
- byte[] apiKey = GenerateKey(16);
-
- if (apiKey == null)
- {
- return Guid.Empty;
- }
-
- return new Guid(apiKey);
- }
-
///
/// Decrypts the data with the provided key. No exceptions are thrown in case of failure.
///
diff --git a/wrappers/csharp/tests/unit-tests/TestManaged.cs b/wrappers/csharp/tests/unit-tests/TestManaged.cs
index 6a1dcff6..1902b19f 100644
--- a/wrappers/csharp/tests/unit-tests/TestManaged.cs
+++ b/wrappers/csharp/tests/unit-tests/TestManaged.cs
@@ -55,7 +55,7 @@ public void DecryptWithKey()
}
[TestMethod]
- public void DecryptWithKeyAsString()
+ public void DecryptWithKeyAsUtf8String()
{
string decryptResultString = Managed.DecryptWithKeyAsUtf8String(TestData.EncryptedData, TestData.BytesTestKey);
Assert.AreEqual(decryptResultString, TestData.Base64TestData);
@@ -90,7 +90,7 @@ public void DecryptWithPassword2_5()
}
[TestMethod]
- public void DecryptWithPasswordAsString()
+ public void DecryptWithPasswordAsUtf8String()
{
string encryptedDataAsBase64 = "DQwCAAAAAgCoE9Y3m06QaPSAiL2qegthcm0+zZWt4fXbdqcefkzD6y8pnWsMzLkx/32t";
string decryptResultString = Managed.DecryptWithPasswordAsUtf8String(encryptedDataAsBase64, TestData.TestPassword);
@@ -153,7 +153,7 @@ public void EncryptBase64WithPasswordAsString()
}
[TestMethod]
- public void EncryptWithKeyAsStringDecryptWithKeyAsString()
+ public void EncryptDecryptWithKeyAsBase64String()
{
byte[] encodedData = Utils.StringToUtf8ByteArray(TestData.StringTestData);
byte[] encodedPassword = Utils.StringToUtf8ByteArray(TestData.TestPassword);
@@ -174,7 +174,7 @@ public void EncryptWithKeyDecryptWithKey()
}
[TestMethod]
- public void EncryptWithPasswordAsString()
+ public void EncryptWithPasswordAsBase64String()
{
byte[] encodedDataAsUtf8ByteArray = Utils.StringToUtf8ByteArray(TestData.StringTestData);
string encryptResultAsBase64String = Managed.EncryptWithPasswordAsBase64String(encodedDataAsUtf8ByteArray, TestData.TestPassword);
@@ -183,7 +183,7 @@ public void EncryptWithPasswordAsString()
}
[TestMethod]
- public void EncryptWithPasswordAsStringAndDecryptWithPasswordAsString()
+ public void EncryptDecryptWithPasswordAsBase64String()
{
byte[] base64EncodedToUtf8ByteArray = Utils.StringToUtf8ByteArray(TestData.Base64TestData);
string password = "pwd";