If Not(File.IsDirectory(drv1&ppk1,"")) Then
msg.Show("Insert an external memory card with keys.", "SanDisk")
Else
If B4JBuildKeys.Build(drv1&ppk1, prv1, txtPrivateKey.Text, pas1) = False Then
msg.Show("The memory card has a SET LOCK,"&CRLF&"REMOVE the LOCK on the memory card !", "SanDisk")
Return
End If
End If
'B4JBuildKeys code module:
Public Sub Build(KeyPath As String, KeyFile As String, Value As Object, password As String) As Boolean
Try
If Not(File.Exists(KeyPath,"")) Or KeyFile.Length = 0 Or Value.As(String).Length = 0 Or password.Length = 0 Then
Return False
End If
Dim raf As RandomAccessFile
raf.Initialize(KeyPath, KeyFile, False)
raf.WriteEncryptedObject(Value, password, raf.CurrentPosition)
raf.Flush
Dim buffer(raf.CurrentPosition) As Byte
raf.ReadBytes(buffer, 0, buffer.Length, 0)
raf.Close
Return True
Catch
Return False
End Try
End Sub