File tree Expand file tree Collapse file tree 4 files changed +2
-11
lines changed
BrowserCookieImplementations Expand file tree Collapse file tree 4 files changed +2
-11
lines changed Original file line number Diff line number Diff line change 3838 <ItemGroup >
3939 <PackageReference Include =" BouncyCastle" Version =" 1.8.9" />
4040 <PackageReference Include =" System.Data.SQLite.Core" Version =" 1.0.114.3" />
41- <PackageReference Include =" System.Security.Cryptography.ProtectedData" Version =" 9.0.8" />
4241 <PackageReference Include =" System.Text.Json" Version =" 9.0.8" />
4342 </ItemGroup >
4443 <ItemGroup >
Original file line number Diff line number Diff line change @@ -83,10 +83,7 @@ private List<Cookie> LoadAllCookies(string file)
8383 {
8484 // 暗号化されたファイルを読み込み
8585 var encrypted = File . ReadAllBytes ( path1 ) ;
86-
87- // DPAPI で復号
88- var bytes = ProtectedData . Unprotect ( encrypted , optionalEntropy : null , scope : DataProtectionScope . LocalMachine ) ;
89- var json = Encoding . UTF8 . GetString ( bytes ) ;
86+ var json = Encoding . UTF8 . GetString ( encrypted ) ;
9087
9188 // JSON を CookieDto のリストにデシリアライズ
9289 var cookieDtos = JsonSerializer . Deserialize < List < CookieDto > > ( json ) ;
Original file line number Diff line number Diff line change @@ -99,11 +99,8 @@ public static async Task SaveCookiesEncryptedAsync(IEnumerable<CoreWebView2Cooki
9999 var json = System . Text . Json . JsonSerializer . Serialize ( list ) ;
100100 var bytes = Encoding . UTF8 . GetBytes ( json ) ;
101101
102- // DPAPI を使って暗号化(LocalMachine スコープ:同一マシン上の別プロセスでも復号可能)
103- var encrypted = ProtectedData . Protect ( bytes , optionalEntropy : null , scope : DataProtectionScope . LocalMachine ) ;
104-
105102 var path = GetCookieFilePath ( siteName ) ;
106- File . WriteAllBytes ( path , encrypted ) ;
103+ File . WriteAllBytes ( path , bytes ) ;
107104 }
108105
109106 // // 暗号化ファイルを復号して CookieContainer を返す
Original file line number Diff line number Diff line change 5656 <PackageReference Include =" SQLitePCLRaw.bundle_winsqlite3" Version =" 2.0.4" />
5757 <PackageReference Include =" System.ComponentModel.Composition" Version =" 5.0.0" />
5858 <PackageReference Include =" System.Data.SQLite.Core" Version =" 1.0.114.3" />
59- <PackageReference Include =" System.Security.Cryptography.ProtectedData" Version =" 9.0.8" />
6059 <PackageReference Include =" System.Text.Json" Version =" 9.0.8" />
61- <PackageReference Include =" WebView2.Runtime.X64" Version =" 139.0.3405.125" />
6260 <PackageReference Include =" WebView2.Runtime.X86" Version =" 139.0.3405.125" />
6361 </ItemGroup >
6462 <ItemGroup >
You can’t perform that action at this time.
0 commit comments