Skip to content

Commit 82403c4

Browse files
chore: Remove previously deprecated methods.
Removes the following methods from the csharp wrapper: - EncryptWithKeyAsString - EncryptWithPasswordAsString - DecryptWithKeyAsString - DecryptWithPasswordAsString - GenerateAPIKey
1 parent aaf996c commit 82403c4

File tree

4 files changed

+14
-148
lines changed

4 files changed

+14
-148
lines changed

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,17 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
66

7-
## [next] -
7+
## [Unreleased] -
8+
9+
### Changed
10+
811
- Multiple functions, such as `generate_key` and `hash_password`, now return a `Result` due to the `rand` library upgrade.
912

13+
### Removed
14+
15+
- Removed `EncryptWithKeyAsString`, `EncryptWithPasswordAsString`, `DecryptWithKeyAsString`, `DecryptWithPasswordAsString`,
16+
`GenerateAPIKey`.
17+
1018
## [0.9.2] - 2025-01-20
1119
- Online encryption feature
1220

wrappers/csharp/Examples.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

wrappers/csharp/src/Managed.cs

Lines changed: 0 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,6 @@ public static Argon2Parameters GetDefaultArgon2Parameters()
8686
return Argon2Parameters.FromByteArray(rawParameters);
8787
}
8888

89-
/// <summary>
90-
/// Encrypts the data (which will be encoded into a UTF8 byte array) with the provided key.
91-
/// </summary>
92-
/// <param name="data">The data to encrypt.</param>
93-
/// <param name="key">The key to use for encryption.</param>
94-
/// <param name="aad">Additional authenticated data. (Optional).</param>
95-
/// <param name="version">The cipher version to use. (Latest is recommended).</param>
96-
/// <returns>Returns the encryption result as a base 64 encoded string.</returns>
97-
[Obsolete("This method has been deprecated. Use EncryptWithKeyAsBase64String instead.")]
98-
public static string EncryptWithKeyAsString(string data, byte[] key, byte[] aad = null, CipherTextVersion version = CIPHERTEXT_VERSION)
99-
{
100-
return EncryptWithKeyAsBase64String(data, key, aad, version);
101-
}
102-
10389
/// <summary>
10490
/// Encrypts the data (which will be encoded into a UTF8 byte array) with the provided key.
10591
/// </summary>
@@ -315,20 +301,6 @@ public static byte[] DecryptAsymmetric(byte[] data, byte[] privateKey, byte[] aa
315301
return result;
316302
}
317303

318-
/// <summary>
319-
/// Encrypts the data with the provided key.
320-
/// </summary>
321-
/// <param name="data">The data to encrypt.</param>
322-
/// <param name="key">The key to use for encryption.</param>
323-
/// <param name="aad">Additional authenticated data. (Optional).</param>
324-
/// <param name="version">The cipher version to use. (Latest is recommended).</param>
325-
/// <returns>Returns the encryption result as a base 64 encoded string.</returns>
326-
[Obsolete("This method has been deprecated. Use EncryptWithKeyAsBase64String instead.")]
327-
public static string EncryptWithKeyAsString(byte[] data, byte[] key, byte[] aad = null, CipherTextVersion version = CIPHERTEXT_VERSION)
328-
{
329-
return EncryptWithKeyAsBase64String(data, key, aad, version);
330-
}
331-
332304
/// <summary>
333305
/// Encrypts the data with the provided key.
334306
/// </summary>
@@ -359,21 +331,6 @@ public static byte[] EncryptWithKey(byte[] data, byte[] key, byte[] aad = null,
359331
return cipher;
360332
}
361333

362-
/// <summary>
363-
/// Encrypts the data with the provided password (which will be encoded into a UTF8 byte array and derived).
364-
/// </summary>
365-
/// <param name="data">The data to encrypt.</param>
366-
/// <param name="password">The password to use for encryption.</param>
367-
/// <param name="iterations">The number of iterations used to derive the password. 10 000 Recommended by NIST.</param>
368-
/// <param name="aad">Additional authenticated data. (Optional).</param>
369-
/// <param name="cipherTextVersion">The cipher version to use. (Latest is recommended).</param>
370-
/// <returns>Returns the encryption result as a base 64 encoded string.</returns>
371-
[Obsolete("This method has been deprecated. Use EncryptWithPasswordAsBase64String instead.")]
372-
public static string EncryptWithPasswordAsString(byte[] data, string password, uint iterations = 10000, byte[] aad = null, CipherTextVersion cipherTextVersion = CIPHERTEXT_VERSION)
373-
{
374-
return EncryptWithPasswordAsBase64String(data, password, iterations, aad, cipherTextVersion);
375-
}
376-
377334
/// <summary>
378335
/// Encrypts the data with the provided password (which will be encoded into a UTF8 byte array and derived).
379336
/// </summary>
@@ -743,21 +700,6 @@ public static byte[] EncryptAsymmetric(byte[] data, byte[] publicKey, byte[] aad
743700
return result;
744701
}
745702

746-
/// <summary>
747-
/// 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).
748-
/// </summary>
749-
/// <param name="data">The data to encrypt.</param>
750-
/// <param name="password">The password to use for encryption.</param>
751-
/// <param name="aad">Additional authenticated data. (Optional).</param>
752-
/// <param name="iterations">The number of iterations used to derive the password. 10 000 Recommended by NIST.</param>
753-
/// <param name="cipherTextVersion">The cipher version to use. (Latest is recommended).</param>
754-
/// <returns>Returns the encryption result as a base 64 encoded string.</returns>
755-
[Obsolete("This method has been deprecated. Use EncryptWithPasswordAsBase64String instead.")]
756-
public static string EncryptWithPasswordAsString(string data, string password, byte[] aad = null, uint iterations = 10000, CipherTextVersion cipherTextVersion = CIPHERTEXT_VERSION)
757-
{
758-
return EncryptWithPasswordAsBase64String(data, password, iterations, aad, cipherTextVersion);
759-
}
760-
761703
/// <summary>
762704
/// 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).
763705
/// </summary>
@@ -890,19 +832,6 @@ public static byte[] EncryptWithPassword(string data, string password, uint iter
890832
return cipher;
891833
}
892834

893-
/// <summary>
894-
/// Decrypts the base64 string with the provided key.
895-
/// </summary>
896-
/// <param name="b64data">The base 64 string to decrypt.</param>
897-
/// <param name="key">The key to use for decryption.</param>
898-
/// <param name="aad">Additional authenticated data. (Optional).</param>
899-
/// <returns>Returns the decryption result as a UTF8 encoded string.</returns>
900-
[Obsolete("This method has been deprecated. Use DecryptWithKeyAsUtf8String instead.")]
901-
public static string DecryptWithKeyAsString(string b64data, byte[] key, byte[] aad = null)
902-
{
903-
return DecryptWithKeyAsUtf8String(b64data, key, aad);
904-
}
905-
906835
/// <summary>
907836
/// Decrypts the base64 string with the provided key.
908837
/// </summary>
@@ -933,19 +862,6 @@ public static byte[] DecryptWithKey(string b64data, byte[] key, byte[] aad = nul
933862
return result;
934863
}
935864

936-
/// <summary>
937-
/// Decrypts the data with the provided key.
938-
/// </summary>
939-
/// <param name="data">The data to decrypt.</param>
940-
/// <param name="key">The key to use for decryption.</param>
941-
/// <param name="aad">Additional authenticated data. (Optional).</param>
942-
/// <returns>Returns the decryption result as a UTF8 encoded string.</returns>
943-
[Obsolete("This method has been deprecated. Use DecryptWithKeyAsUtf8String instead.")]
944-
public static string DecryptWithKeyAsString(byte[] data, byte[] key, byte[] aad = null)
945-
{
946-
return DecryptWithKeyAsUtf8String(data, key, aad);
947-
}
948-
949865
/// <summary>
950866
/// Decrypts the data with the provided key.
951867
/// </summary>
@@ -976,20 +892,6 @@ public static byte[] DecryptWithKey(byte[] data, byte[] key, byte[] aad = null,
976892
return result;
977893
}
978894

979-
/// <summary>
980-
/// Decrypts the data with the provided password (which will be encoded into a UTF8 byte array and derived).
981-
/// </summary>
982-
/// <param name="data">The data to decrypt.</param>
983-
/// <param name="password">The password to use for decryption.</param>
984-
/// <param name="iterations">The number of iterations used to derive the password.</param>
985-
/// <param name="aad">Additional authenticated data. (Optional).</param>
986-
/// <returns>Returns the decryption result as a UTF8 encoded string.</returns>
987-
[Obsolete("This method has been deprecated. Use DecryptWithPasswordAsUtf8String instead.")]
988-
public static string DecryptWithPasswordAsString(byte[] data, string password, uint iterations = 10000, byte[] aad = null)
989-
{
990-
return DecryptWithPasswordAsUtf8String(data, password, iterations, aad);
991-
}
992-
993895
/// <summary>
994896
/// Decrypts the data with the provided password (which will be encoded into a UTF8 byte array and derived).
995897
/// </summary>
@@ -1040,20 +942,6 @@ public static string DecryptWithPasswordAsUtf8String(byte[] data, string passwor
1040942
return Utils.ByteArrayToUtf8String(result);
1041943
}
1042944

1043-
/// <summary>
1044-
/// 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).
1045-
/// </summary>
1046-
/// <param name="b64data">The data to decrypt.</param>
1047-
/// <param name="password">The password to use for decryption.</param>
1048-
/// <param name="iterations">The number of iterations used to derive the password.</param>
1049-
/// <param name="aad">Additional authenticated data. (Optional).</param>
1050-
/// <returns>Returns the decryption result as a UTF8 encoded string.</returns>
1051-
[Obsolete("This method has been deprecated. Use DecryptWithPasswordAsUtf8String instead.")]
1052-
public static string DecryptWithPasswordAsString(string b64data, string password, uint iterations = 10000, byte[] aad = null)
1053-
{
1054-
return DecryptWithPasswordAsUtf8String(b64data, password, iterations, aad);
1055-
}
1056-
1057945
/// <summary>
1058946
/// Join multiple shares to regenerate a shared secret.
1059947
/// </summary>
@@ -1301,23 +1189,6 @@ public static byte[] DecryptWithPassword(string b64data, string password, uint i
13011189
return result;
13021190
}
13031191

1304-
/// <summary>
1305-
/// Generates an API key.
1306-
/// </summary>
1307-
/// <returns>An API key formated as a Guid.</returns>
1308-
[Obsolete("This method has been deprecated. Use Managed.GenerateKey instead.")]
1309-
public static Guid GenerateAPIKey()
1310-
{
1311-
byte[] apiKey = GenerateKey(16);
1312-
1313-
if (apiKey == null)
1314-
{
1315-
return Guid.Empty;
1316-
}
1317-
1318-
return new Guid(apiKey);
1319-
}
1320-
13211192
/// <summary>
13221193
/// Decrypts the data with the provided key. No exceptions are thrown in case of failure.
13231194
/// </summary>

wrappers/csharp/tests/unit-tests/TestManaged.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public void DecryptWithKey()
5555
}
5656

5757
[TestMethod]
58-
public void DecryptWithKeyAsString()
58+
public void DecryptWithKeyAsUtf8String()
5959
{
6060
string decryptResultString = Managed.DecryptWithKeyAsUtf8String(TestData.EncryptedData, TestData.BytesTestKey);
6161
Assert.AreEqual(decryptResultString, TestData.Base64TestData);
@@ -90,7 +90,7 @@ public void DecryptWithPassword2_5()
9090
}
9191

9292
[TestMethod]
93-
public void DecryptWithPasswordAsString()
93+
public void DecryptWithPasswordAsUtf8String()
9494
{
9595
string encryptedDataAsBase64 = "DQwCAAAAAgCoE9Y3m06QaPSAiL2qegthcm0+zZWt4fXbdqcefkzD6y8pnWsMzLkx/32t";
9696
string decryptResultString = Managed.DecryptWithPasswordAsUtf8String(encryptedDataAsBase64, TestData.TestPassword);
@@ -153,7 +153,7 @@ public void EncryptBase64WithPasswordAsString()
153153
}
154154

155155
[TestMethod]
156-
public void EncryptWithKeyAsStringDecryptWithKeyAsString()
156+
public void EncryptDecryptWithKeyAsBase64String()
157157
{
158158
byte[] encodedData = Utils.StringToUtf8ByteArray(TestData.StringTestData);
159159
byte[] encodedPassword = Utils.StringToUtf8ByteArray(TestData.TestPassword);
@@ -174,7 +174,7 @@ public void EncryptWithKeyDecryptWithKey()
174174
}
175175

176176
[TestMethod]
177-
public void EncryptWithPasswordAsString()
177+
public void EncryptWithPasswordAsBase64String()
178178
{
179179
byte[] encodedDataAsUtf8ByteArray = Utils.StringToUtf8ByteArray(TestData.StringTestData);
180180
string encryptResultAsBase64String = Managed.EncryptWithPasswordAsBase64String(encodedDataAsUtf8ByteArray, TestData.TestPassword);
@@ -183,7 +183,7 @@ public void EncryptWithPasswordAsString()
183183
}
184184

185185
[TestMethod]
186-
public void EncryptWithPasswordAsStringAndDecryptWithPasswordAsString()
186+
public void EncryptDecryptWithPasswordAsBase64String()
187187
{
188188
byte[] base64EncodedToUtf8ByteArray = Utils.StringToUtf8ByteArray(TestData.Base64TestData);
189189
string password = "pwd";

0 commit comments

Comments
 (0)