我无法将java代码转换为VB.NET
SecretKeySpec skey = new SecretKeySpec(key, "DESede");
任何想法?谢谢:))
答案 0 :(得分:0)
Dim skey As SecretKeySpec = New SecretKeySpec(key, "DESede")
当然,让它正常工作取决于您如何翻译SecretKeySpec
定义。
答案 1 :(得分:0)
Public Function GenerateTripleDesKey() As Byte()
Dim rng As New RNGCryptoServiceProvider()
Dim tripleDesKey As Byte() = New Byte(23) {}
rng.GetBytes(tripleDesKey)
For i As Integer = 0 To tripleDesKey.Length - 1
Dim keyByte As Integer = tripleDesKey(i) And &HFE
Dim parity = 0
Dim b As Integer = keyByte
While b <> 0
parity = parity Xor b And 1
b >>= 1
End While
tripleDesKey(i) = CByte(keyByte Or (If(parity = 0, 1, 0)))
Next
Return tripleDesKey
End Function