質問編集履歴
1
文法の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -58,7 +58,7 @@
|
|
58
58
|
|
59
59
|
Sample sample = new Sample();
|
60
60
|
|
61
|
-
Console.WriteLine(sample.Dec
|
61
|
+
Console.WriteLine(sample.Decode("...","aaa"));
|
62
62
|
|
63
63
|
|
64
64
|
|
@@ -68,21 +68,21 @@
|
|
68
68
|
|
69
69
|
|
70
70
|
|
71
|
-
private string Dec
|
71
|
+
private string Decode(string text, string p)
|
72
72
|
|
73
73
|
{
|
74
74
|
|
75
|
-
System.Security.Cryptography.RijndaelManaged _rijnde
|
75
|
+
System.Security.Cryptography.RijndaelManaged _rijndael = new System.Security.Cryptography.RijndaelManaged();
|
76
76
|
|
77
77
|
|
78
78
|
|
79
79
|
byte[] _key, _iv;
|
80
80
|
|
81
|
-
GenerateKeyFromPassWord(p, _rijnde
|
81
|
+
GenerateKeyFromPassWord(p, _rijndael.KeySize, out _key, _rijndael.BlockSize, out _iv);
|
82
82
|
|
83
|
-
_rijnde
|
83
|
+
_rijndael.Key = _key;
|
84
84
|
|
85
|
-
_rijnde
|
85
|
+
_rijndael.IV = _iv;
|
86
86
|
|
87
87
|
|
88
88
|
|
@@ -90,7 +90,7 @@
|
|
90
90
|
|
91
91
|
|
92
92
|
|
93
|
-
System.Security.Cryptography.ICryptoTransform _decryptor = _rijnde
|
93
|
+
System.Security.Cryptography.ICryptoTransform _decryptor = _rijndael.CreateDecryptor();
|
94
94
|
|
95
95
|
|
96
96
|
|
@@ -106,23 +106,21 @@
|
|
106
106
|
|
107
107
|
|
108
108
|
|
109
|
-
public static void G
|
109
|
+
public static void GKFP(string pass, int keySize, out byte[] key, int blockSize, out byte[] iv)
|
110
110
|
|
111
111
|
{
|
112
112
|
|
113
|
-
byte[] _salt = System.Text.Encoding.UTF8.GetBytes("
|
113
|
+
byte[] _salt = System.Text.Encoding.UTF8.GetBytes("・・・");
|
114
114
|
|
115
115
|
|
116
116
|
|
117
|
-
System.Security.Cryptography.Rfc2898DeriveBytes _deviceBytes = new System.Security.Cryptography.Rfc2898DeriveBytes(pass, _salt);
|
117
|
+
System.Security.Cryptography.Rfc2898DeriveBytes _deviceBytes = new System.Security.Cryptography.Rfc2898DeriveBytes(password, _salt);
|
118
118
|
|
119
|
-
|
119
|
+
|
120
120
|
|
121
|
+
key = _deviceBytes.GetBytes(keySize);
|
121
122
|
|
122
|
-
|
123
|
-
key = _deviceBytes.GetBytes(keySize / 8);
|
124
|
-
|
125
|
-
iv = _deviceBytes.GetBytes(blockSize
|
123
|
+
iv = _deviceBytes.GetBytes(blockSize);
|
126
124
|
|
127
125
|
}
|
128
126
|
|