Public Shared Function EncryptRSA(ByVal infilename As String, ByVal outfilename As String, ByVal pubkey As String) As String
Dim buffer2 As Byte()
Dim buffer3 As Byte()
Dim provider As New RSACryptoServiceProvider
provider.FromXmlString(File.ReadAllText(pubkey))
Dim sourceArray As Byte() = File.ReadAllBytes(infilename)
Dim num As Integer = (sourceArray.Length / &H3A)
Dim stream As FileStream = File.Create(outfilename)
Dim num2 As Integer = 0
For num2 = 0 To num - 1
buffer2 = New Byte(&H3A - 1) {}
Array.Copy(sourceArray, (num2 * &H3A), buffer2, 0, &H3A)
buffer3 = provider.Encrypt(buffer2, True)
stream.Write(buffer3, 0, buffer3.Length)
Next num2
If ((sourceArray.Length Mod &H3A) <> 0) Then
buffer2 = New Byte((sourceArray.Length Mod &H3A) - 1) {}
Array.Copy(sourceArray, ((sourceArray.Length / &H3A) * &H3A), buffer2, 0, (sourceArray.Length Mod &H3A))
buffer3 = provider.Encrypt(buffer2, True)
stream.Write(buffer3, 0, buffer3.Length)
End If
stream.Close()
Return File.ReadAllText(outfilename)
End Function
エラー 1 アクセス可能な 'Copy' を縮小変換なしで呼び出すことができないため、オーバーロードの解決に失敗しました: 'Public Shared Sub Copy(sourceArray As System.Array, sourceIndex As Long, destinationArray As System.Array, destinationIndex As Long, length As Long)' : 引数一致パラメーター 'sourceIndex' は 'Double' から 'Long' に絞り込まれます。'Public Shared Sub Copy(sourceArray As System.Array, sourceIndex As Integer, destinationArray As System.Array, destinationIndex As Integer, length As Integer)': 引数一致パラメーター 'sourceIndex' は 'Double' から 'Integer' に絞り込まれます。C:\Users\user\AppData\Local\Temporary Projects\WindowsApplication1\Crypto.vb 52 13 WindowsApplication1