Re: How to load a string in a certificate ? (General questions)
Here, what I tryed :
Public Function TexteToBase64(ByVal Texte As String) As String
Try
Dim texteBytes As Byte() = Encoding.ASCII.GetBytes(Texte)
If texteBytes.Length = 0 Then
Return
Else
Return Convert.ToBase64String(texteBytes)
End If
Catch ex As Exception
Return
End Try
End Function
ppk = -----BEGIN RSA PRIVATE KEY----- & vbLf
ppk = ppk & key & vblf
ppk = ppk & -----END RSA PRIVATE KEY----- & vbLf
ftp1 = New wodFtpDLXComLib.wodFtpDLXCom
ftp1.Certificate = TexteToBase64(ppk)
And I got this :
ystem.InvalidCastException: Unable to cast object of type 'System.String' to type 'wodFtpDLXComLib.ICertificate'.