質問編集履歴
2
見やすく簡素化
test
CHANGED
File without changes
|
test
CHANGED
@@ -8,38 +8,12 @@
|
|
8
8
|
|
9
9
|
|
10
10
|
|
11
|
-
|
11
|
+
|
12
|
-
|
13
|
-
![イメージ説明](367a8a4ec666244bb3da16d27038df61.jpeg)
|
14
|
-
|
15
|
-
**↓D&Dしたテキストファイル**
|
16
|
-
|
17
|
-
![イメージ説明](a8a666734aeb0ba6af7befffed0d8520.jpeg)
|
18
12
|
|
19
13
|
###コード
|
20
14
|
|
21
15
|
```C#
|
22
16
|
|
23
|
-
using System;
|
24
|
-
|
25
|
-
using System.IO;
|
26
|
-
|
27
|
-
using System.Collections.Generic;
|
28
|
-
|
29
|
-
using System.ComponentModel;
|
30
|
-
|
31
|
-
using System.Data;
|
32
|
-
|
33
|
-
using System.Drawing;
|
34
|
-
|
35
|
-
using System.Linq;
|
36
|
-
|
37
|
-
using System.Text;
|
38
|
-
|
39
|
-
using System.Threading.Tasks;
|
40
|
-
|
41
|
-
using System.Windows.Forms;
|
42
|
-
|
43
17
|
|
44
18
|
|
45
19
|
namespace WindowsFormsApp2
|
@@ -156,29 +130,29 @@
|
|
156
130
|
|
157
131
|
|
158
132
|
|
159
|
-
private string DecS(string text, string p)
|
133
|
+
private string DecS(string text, string pass)
|
160
|
-
|
134
|
+
|
161
|
-
{
|
135
|
+
{
|
162
|
-
|
136
|
+
|
163
|
-
System.Security.Cryptography.RijndaelManaged _rijnde
|
137
|
+
System.Security.Cryptography.RijndaelManaged _rijndael = new System.Security.Cryptography.RijndaelManaged();
|
164
138
|
|
165
139
|
|
166
140
|
|
167
141
|
byte[] _key, _iv;
|
168
142
|
|
169
|
-
GenerateKeyFromPassWord(p, _rijnde
|
143
|
+
GenerateKeyFromPassWord(pass, _rijndael.KeySize, out _key, _rijndael.BlockSize, out iv);
|
170
|
-
|
144
|
+
|
171
|
-
_rijnde
|
145
|
+
_rijndael.Key = key;
|
172
|
-
|
146
|
+
|
173
|
-
_rijnde
|
147
|
+
_rijndael.IV = iv;
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
181
|
-
System.Security.Cryptography.ICryptoTransform _decryptor = _rijnde
|
155
|
+
System.Security.Cryptography.ICryptoTransform _decryptor = _rijndael.CreateDecryptor();
|
182
156
|
|
183
157
|
|
184
158
|
|
@@ -206,7 +180,7 @@
|
|
206
180
|
|
207
181
|
{
|
208
182
|
|
209
|
-
byte[] _salt = System.Text.Encoding.UTF8.GetBytes("
|
183
|
+
byte[] _salt = System.Text.Encoding.UTF8.GetBytes("・・・");
|
210
184
|
|
211
185
|
|
212
186
|
|
@@ -216,9 +190,9 @@
|
|
216
190
|
|
217
191
|
|
218
192
|
|
219
|
-
key = _deviceBytes.GetBytes(keySize
|
193
|
+
key = _deviceBytes.GetBytes(keySize);
|
220
|
-
|
194
|
+
|
221
|
-
iv = _deviceBytes.GetBytes(blockSize
|
195
|
+
iv = _deviceBytes.GetBytes(blockSize);
|
222
196
|
|
223
197
|
}
|
224
198
|
|
1
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -122,7 +122,7 @@
|
|
122
122
|
|
123
123
|
//ここで復号実行
|
124
124
|
|
125
|
-
PlainText = DecS(EncryptedText,"w
|
125
|
+
PlainText = DecS(EncryptedText,"passwordAAA");
|
126
126
|
|
127
127
|
//D&Dしたテキストの中身そのまま表示=うまくいく
|
128
128
|
|