-
Notifications
You must be signed in to change notification settings - Fork 0
/
SisCryptoSymmetric.cs
22 lines (17 loc) · 1.14 KB
/
SisCryptoSymmetric.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
using SisCrypto.Backends;
namespace SisCrypto {
public static partial class SisCrypto {
public static SymmetricEncryptResult SymmetricEncrypt(Secret<byte[]> key, byte[] salt, byte[] data, int version = SISCRYPTO_LATEST_VERSION) {
return SisCryptoBackend.GetVersion(version).SymmetricEncrypt(key, salt, data);
}
public static SymmetricEncryptResult SymmetricEncrypt(Secret<byte[]> key, byte[] data, int version = SISCRYPTO_LATEST_VERSION)
=> SymmetricEncrypt(key, SisCryptoRandom.GetSecureBytes(16), data, version);
public static SymmetricEncryptResult SymmetricEncrypt(Secret<byte[]> key, string data, int version = SISCRYPTO_LATEST_VERSION)
=> SymmetricEncrypt(key, StringToBytes(data, version), version);
public static SymmetricEncryptResult SymmetricEncrypt(Secret<byte[]> key, byte[] salt, string data, int version = SISCRYPTO_LATEST_VERSION)
=> SymmetricEncrypt(key, salt, StringToBytes(data, version), version);
public static byte[] SymmetricDecrypt(Secret<byte[]> key, SymmetricEncryptResult data) {
return SisCryptoBackend.GetVersion(data.Version).SymmetricDecrypt(key, data);
}
}
}