ライセンス暗号化キーを受け入れるアプリケーションがあります。したがって、このアプリケーションは、string encryptionPassword
その文字列を復号化してデータを取得するために内部に保持する必要があります。
アプリケーションの内部を維持するための最良のアプローチはどれですかstring encryptionPassword
。ユーザーがそれをハッキングしようとして、それを行うのが非常に難しい場合はどうでしょうか。
どんな手掛かり?
ありがとうございました!!!
public static string Encrypt(string textToEncrypt, string encryptionPassword)
{
var algorithm = GetAlgorithm(encryptionPassword);
byte[] encryptedBytes;
using (ICryptoTransform encryptor = algorithm.CreateEncryptor(algorithm.Key, algorithm.IV))
{
byte[] bytesToEncrypt = Encoding.UTF8.GetBytes(textToEncrypt);
encryptedBytes = InMemoryCrypt(bytesToEncrypt, encryptor);
}
return Convert.ToBase64String(encryptedBytes);
}
public static string Decrypt(string encryptedText, string encryptionPassword)
{
var algorithm = GetAlgorithm(encryptionPassword);
byte[] descryptedBytes;
using (ICryptoTransform decryptor = algorithm.CreateDecryptor(algorithm.Key, algorithm.IV))
{
byte[] encryptedBytes = Convert.FromBase64String(encryptedText);
descryptedBytes = InMemoryCrypt(encryptedBytes, decryptor);
}
return Encoding.UTF8.GetString(descryptedBytes);
}