/// <summary> /// Set the registry key which shows Daytimer as fully activated. /// </summary> public static void Activate() { string data = "A" + RandomFunctions.GetBIOSSerialNumber(); byte[] k = SecurityKeys.GenerateKey(data); byte[] iv = SecurityKeys.GenerateIV(data); Hash = Encryption.EncryptStringToBytes(Key, k, iv); }
private static bool isActivated(bool allowGracePeriod) { string key = Key; if (!IsKeyValid(key)) { return(false); } if (allowGracePeriod) { if (IsWithinActivationGracePeriod()) { return(true); } } string data = "A" + RandomFunctions.GetBIOSSerialNumber(); byte[] k = SecurityKeys.GenerateKey(data); byte[] iv = SecurityKeys.GenerateIV(data); byte[] encryptedKey = Hash; if (encryptedKey == null) { return(false); } string decryptedKey = Encryption.DecryptStringFromBytes(encryptedKey, k, iv); if (decryptedKey == key) { return(true); } return(false); }