EldoS | Feel safer!

Software components for data protection, secure storage and transfer

OnKeyValidate and ServerKey.Fingerprint

Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.
Posted: 02/16/2009 07:50:58
by Bo Olsson (Standard support level)
Joined: 11/28/2008
Posts: 2


I am trying to authenticate the server I am connecting to by inspecting the fingerprint of its public key. I am using vb6 and SBB6. I assign the fingerprint to a variant in the OnKeyValidate event

myFingerprint = ServerKey.FingerprintSHA1

If I print this variant I get ??????????, that is a string of 10 questionmarks.
Obviously I am not doing this right since I get the same string from several different servers. Please help me.

Posted: 02/16/2009 08:10:56
by Ken Ivanov (EldoS Corp.)

Please use the following function to convert a variant array to a hexadecimal string:
Public Function ByteArr2HexStr(ByRef v As Variant) As String
    Dim i As Integer
    Dim b As Byte
    Dim C As String
    Dim result As String
    If VarType(v) <> vbArray + vbByte Then
        ByteArr2HexStr = ""
        Exit Function
    End If
    For i = LBound(v) To UBound(v)
        result = result + Hex(v(i))
        If i <> UBound(v) Then
            result = result + ":"
        End If
    ByteArr2HexStr = result

End Function


S = "Server key fingerprint: " + ByteArr2HexStr(ServerKey.FingerprintSHA1)
Posted: 02/16/2009 08:11:00
by Eugene Mayevski (EldoS Corp.)

FingerprintSHA1 is a binary value, not a string. So you get garbage in your string.

Sincerely yours
Eugene Mayevski
Posted: 02/17/2009 05:59:37
by Bo Olsson (Standard support level)
Joined: 11/28/2008
Posts: 2

Thanks for the help. It works just fine.




Topic viewed 1555 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!