Skip to content

Commit 37ab5e8

Browse files
authored
Merge pull request #545 from Freeesia/feature/fix_google_auth
Google翻訳が利用できない問題修正
2 parents 7fae5f1 + ae30971 commit 37ab5e8

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Plugins/WindowTranslator.Plugin.GoogleAppsSctiptPlugin/GasTranslator.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,10 @@ private static string Decrypt(string cipherTextBase64)
116116
byte[] salt = Encoding.UTF8.GetBytes("wX9&7QjrkK%@");
117117
using var aes = Aes.Create();
118118
// PBKDF2 を使って、パスワードから鍵と IV を生成
119-
aes.Key = Rfc2898DeriveBytes.Pbkdf2(password, salt, 10000, HashAlgorithmName.SHA256, 32);
120-
aes.IV = Rfc2898DeriveBytes.Pbkdf2(password, salt, 10000, HashAlgorithmName.SHA256, 16);
119+
Span<byte> buf = stackalloc byte[48];
120+
Rfc2898DeriveBytes.Pbkdf2(password, salt.AsSpan(), buf, 10000, HashAlgorithmName.SHA256);
121+
aes.Key = buf[..32].ToArray();
122+
aes.IV = buf[32..].ToArray();
121123
aes.Padding = PaddingMode.PKCS7;
122124

123125
using var decryptor = aes.CreateDecryptor(aes.Key, aes.IV);

0 commit comments

Comments
 (0)