[fpc-pascal] SSH connection with cryptlib, error -32

Jürgen Hestermann juergen.hestermann at gmx.de
Sun Aug 30 17:49:24 CEST 2009


I have a program that connects to (cisco) network switches with telnet. 
It uses Ararat Synapse for the network part. Now some switches were 
changed to a secure SSH connection and I wanted to reflect that in my 
program. I used Cryplib and all the stuff as mentioned here: 
http://cryptlib.sogot.de and logon with SSHLogon. But the connection 
fails. I used Cryptlib Spy to check what goes wrong and got the 
following output:

-----------------------------------------------------------------------
cryptInit();
Cryptlib CL32.DLL version: 3.3.2
cryptAddRandom(randomData, -301);
cryptCreateSession(&session, CRYPT_UNUSED, CRYPT_SESSION_SSH);
   session = 316
cryptSetAttributeString(316, CRYPT_SESSINFO_USERNAME, value, 8);
cryptSetAttributeString(316, CRYPT_SESSINFO_PASSWORD, value, 9);
cryptSetAttribute(316, CRYPT_SESSINFO_NETWORKSOCKET, 212);
cryptSetAttribute(316, CRYPT_SESSINFO_ACTIVE, 1);
->function returns errorcode -32 ( = Bad/unrecognised data format )
cryptGetAttributeString(316, CRYPT_ATTRIBUTE_INT_ERRORMESSAGE, NULL, 
&valueLength);
   valueLength = 46
cryptGetAttributeString(316, CRYPT_ATTRIBUTE_INT_ERRORMESSAGE, value, 
&valueLength);
   valueLength = 46
cryptDestroySession(316);
cryptEnd();
-----------------------------------------------------------------------

Does anybody have an idea what to do here? There is the error -32 
(bad/unrecognized data format) but I don't know why it appears and how 
to overcome it. I am not an expert in cryptocraphy and therefore can't 
imagine what is wrong. Do I need some extra cryptographic keys? If I use 
PuTTY I can connect to the switches without problem but on first startup 
  of PuTTY I got a warning saying something about keys (which I don't 
remember exactly and it did not reappear).



More information about the fpc-pascal mailing list