help

Bharathi Nandhan <[email protected]> Mon, 23 Apr 2018 13:59:31 +0530
Newsgroups gmane.comp.encryption.cryptlib
Message-ID <CAJbUiEitCToZNC0_w=Z1W6gg8fhwH33jHfHWUcRicAgbknvgDA@mail.gmail.com>
--===============7513591499248312706==
Content-Type: multipart/alternative; boundary="0000000000004e8dd0056a7fd644"

--0000000000004e8dd0056a7fd644
Content-Type: text/plain; charset="UTF-8"

Hello,

     Am trying to write a program using crypt library, which can connect to
ssh server and execute commands remotely.

     I was successful in creating ssh session and writing data to the
session. But, i couldnt able to read data from the session.

     Below is the code which i used for creating, writing and reading
output back from ssh session.

     Please let me know your thoughts and correct me.

    cryptInit();

    CRYPT_SESSION cryptSession;


    int bytesCopied, status;

    /* Create a client session */

    status = cryptCreateSession( &cryptSession, CRYPT_UNUSED /* CRYPT_UNUSED */,

    CRYPT_SESSION_SSH );

    if( cryptStatusError( status ) )

    {

        qDebug() << "Couldnt able to create session";

    }


    /* Set servername and password to the session */

    const char c_username[30] = "ssh://[email protected]";

    const char c_password[10] = "xx";

    status = cryptSetAttributeString( cryptSession, CRYPT_SESSINFO_SERVER_NAME,

    c_username, strlen(c_username) );

    if( cryptStatusError( status ) )

    {

        cryptDestroySession( cryptSession );

        qDebug() << "Couldnt able to input servername to the session";

    }

    status = cryptSetAttributeString( cryptSession, CRYPT_SESSINFO_PASSWORD,

    c_password, strlen(c_password) );

    if( cryptStatusError( status ) )

    {

        cryptDestroySession( cryptSession );

        qDebug() << "Couldnt able to input password to the session";

    }

    else

    {

        qDebug() << "Success";

    }


    /* Activate the session */

    status = cryptSetAttribute( cryptSession, CRYPT_SESSINFO_ACTIVE, TRUE );

    if( cryptStatusError( status ) )

    {

        cryptDestroySession( cryptSession );

        if ( status = CRYPT_ERROR_WRONGKEY)

            qDebug() << "Couldnt able to activate session" << status;

    }

    else

    {

        qDebug() << "Session activated";

    }


    /* Send a command to the remote system */

    char command[30] = "ls -l\r\n";

    status = cryptPushData( cryptSession, command, strlen( command ),
&bytesCopied );

    if( cryptStatusOK( status ) )

    {

        if( bytesCopied != ( int ) strlen( command ) )

            status = -1; /* Not all data was processed */

        else

        {

            status = cryptFlushData( cryptSession );

            qDebug() << "Flushed Data"<< status;

        }

    }



    /* Read back the response */

    int *outDataLength = 0, outDataMaxLength = 500;

    char outData[499];


    status = cryptPopData( cryptSession, outData, outDataMaxLength,
outDataLength );

    if( cryptStatusError( status ) )

    {

        cryptDestroySession( cryptSession );

        qDebug() << "Error Reading data" << status;

    }


    //cryptDestroySession( cryptSession );

    qDebug() << "Return Value:"<<outData;

    qDebug() << "Bytes Copied:"<<*outDataLength;


    cryptDestroySession( cryptSession );

    cryptEnd();


Regards,
Bharathinandhan R

--0000000000004e8dd0056a7fd644
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hello,=C2=A0<div><br></div><div>=C2=A0 =C2=A0 =C2=A0Am try=
ing to write a program using crypt library, which can connect to ssh server=
 and execute commands remotely.=C2=A0</div><div><br></div><div>=C2=A0 =C2=
=A0 =C2=A0I was successful in creating ssh session and writing data to the =
session. But, i couldnt able to read data from the session.</div><div>=C2=
=A0 =C2=A0 =C2=A0</div><div>=C2=A0 =C2=A0 =C2=A0Below is the code which i u=
sed for creating, writing and reading output back from ssh session.=C2=A0</=
div><div><br></div><div>=C2=A0 =C2=A0 =C2=A0Please let me know your thought=
s and correct me.</div><div><br></div><div>

<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(0,103,124)">cryptInit</span>();</=
pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(128,0,128)">CRYPT_SESSION</span><=
span style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(9,46=
,100)">cryptSession</span>;</pre>
<pre style=3D"margin:0px;text-indent:0px"><br></pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(128,128,0)">int</span><span style=
=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(9,46,100)">byt=
esCopied</span>,<span style=3D"color:rgb(192,192,192)"> </span><span style=
=3D"color:rgb(9,46,100)">status</span>;</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(0,128,0)">/*</span><span style=3D=
"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,128,0)">Create<=
/span><span style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:r=
gb(0,128,0)">a</span><span style=3D"color:rgb(192,192,192)"> </span><span s=
tyle=3D"color:rgb(0,128,0)">client</span><span style=3D"color:rgb(192,192,1=
92)"> </span><span style=3D"color:rgb(0,128,0)">session</span><span style=
=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,128,0)">*/</=
span></pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(9,46,100)">status</span><span sty=
le=3D"color:rgb(192,192,192)"> </span>=3D<span style=3D"color:rgb(192,192,1=
92)"> </span><span style=3D"color:rgb(0,103,124)">cryptCreateSession</span>=
(<span style=3D"color:rgb(192,192,192)"> </span>&amp;<span style=3D"color:r=
gb(9,46,100)">cryptSession</span>,<span style=3D"color:rgb(192,192,192)"> <=
/span><span style=3D"color:rgb(0,0,128)">CRYPT_UNUSED</span><span style=3D"=
color:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,128,0)">/*</span=
><span style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,=
128,0)">CRYPT_UNUSED</span><span style=3D"color:rgb(192,192,192)"> </span><=
span style=3D"color:rgb(0,128,0)">*/</span>,</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(128,0,128)">CRYPT_SESSION_SSH</sp=
an><span style=3D"color:rgb(192,192,192)"> </span>);</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(128,128,0)">if</span>(<span style=
=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,0,128)">cryp=
tStatusError</span>(<span style=3D"color:rgb(192,192,192)"> </span><span st=
yle=3D"color:rgb(9,46,100)">status</span><span style=3D"color:rgb(192,192,1=
92)"> </span>)<span style=3D"color:rgb(192,192,192)"> </span>)</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span>{</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">        </span><span style=3D"color:rgb(0,0,128)">qDebug</span>()<spa=
n style=3D"color:rgb(192,192,192)"> </span>&lt;&lt;<span style=3D"color:rgb=
(192,192,192)"> </span><span style=3D"color:rgb(0,128,0)">&quot;Couldnt</sp=
an><span style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(=
0,128,0)">able</span><span style=3D"color:rgb(192,192,192)"> </span><span s=
tyle=3D"color:rgb(0,128,0)">to</span><span style=3D"color:rgb(192,192,192)"=
> </span><span style=3D"color:rgb(0,128,0)">create</span><span style=3D"col=
or:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,128,0)">session&quo=
t;</span>;</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span>}</pre>
<pre style=3D"margin:0px;text-indent:0px"><br></pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(0,128,0)">/*</span><span style=3D=
"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,128,0)">Set</sp=
an><span style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(=
0,128,0)">servername</span><span style=3D"color:rgb(192,192,192)"> </span><=
span style=3D"color:rgb(0,128,0)">and</span><span style=3D"color:rgb(192,19=
2,192)"> </span><span style=3D"color:rgb(0,128,0)">password</span><span sty=
le=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,128,0)">to=
</span><span style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:=
rgb(0,128,0)">the</span><span style=3D"color:rgb(192,192,192)"> </span><spa=
n style=3D"color:rgb(0,128,0)">session</span><span style=3D"color:rgb(192,1=
92,192)"> </span><span style=3D"color:rgb(0,128,0)">*/</span></pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(128,128,0)">const</span><span sty=
le=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(128,128,0)">=
char</span><span style=3D"color:rgb(192,192,192)"> </span><span style=3D"co=
lor:rgb(9,46,100)">c_username</span>[<span style=3D"color:rgb(0,0,128)">30<=
/span>]<span style=3D"color:rgb(192,192,192)"> </span>=3D<span style=3D"col=
or:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,128,0)">&quot;ssh:/=
/[email protected]&quot;</span>;</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(128,128,0)">const</span><span sty=
le=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(128,128,0)">=
char</span><span style=3D"color:rgb(192,192,192)"> </span><span style=3D"co=
lor:rgb(9,46,100)">c_password</span>[<span style=3D"color:rgb(0,0,128)">10<=
/span>]<span style=3D"color:rgb(192,192,192)"> </span>=3D<span style=3D"col=
or:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,128,0)">&quot;xx&qu=
ot;</span>;</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(9,46,100)">status</span><span sty=
le=3D"color:rgb(192,192,192)"> </span>=3D<span style=3D"color:rgb(192,192,1=
92)"> </span><span style=3D"color:rgb(0,103,124)">cryptSetAttributeString</=
span>(<span style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:r=
gb(9,46,100)">cryptSession</span>,<span style=3D"color:rgb(192,192,192)"> <=
/span><span style=3D"color:rgb(128,0,128)">CRYPT_SESSINFO_SERVER_NAME</span=
>,</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(9,46,100)">c_username</span>,<spa=
n style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,103,1=
24)">strlen</span>(<span style=3D"color:rgb(9,46,100)">c_username</span>)<s=
pan style=3D"color:rgb(192,192,192)"> </span>);</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(128,128,0)">if</span>(<span style=
=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,0,128)">cryp=
tStatusError</span>(<span style=3D"color:rgb(192,192,192)"> </span><span st=
yle=3D"color:rgb(9,46,100)">status</span><span style=3D"color:rgb(192,192,1=
92)"> </span>)<span style=3D"color:rgb(192,192,192)"> </span>)</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span>{</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">        </span><span style=3D"color:rgb(0,103,124)">cryptDestroySessi=
on</span>(<span style=3D"color:rgb(192,192,192)"> </span><span style=3D"col=
or:rgb(9,46,100)">cryptSession</span><span style=3D"color:rgb(192,192,192)"=
> </span>);</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">        </span><span style=3D"color:rgb(0,0,128)">qDebug</span>()<spa=
n style=3D"color:rgb(192,192,192)"> </span>&lt;&lt;<span style=3D"color:rgb=
(192,192,192)"> </span><span style=3D"color:rgb(0,128,0)">&quot;Couldnt</sp=
an><span style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(=
0,128,0)">able</span><span style=3D"color:rgb(192,192,192)"> </span><span s=
tyle=3D"color:rgb(0,128,0)">to</span><span style=3D"color:rgb(192,192,192)"=
> </span><span style=3D"color:rgb(0,128,0)">input</span><span style=3D"colo=
r:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,128,0)">servername</=
span><span style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rg=
b(0,128,0)">to</span><span style=3D"color:rgb(192,192,192)"> </span><span s=
tyle=3D"color:rgb(0,128,0)">the</span><span style=3D"color:rgb(192,192,192)=
"> </span><span style=3D"color:rgb(0,128,0)">session&quot;</span>;</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span>}</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(9,46,100)">status</span><span sty=
le=3D"color:rgb(192,192,192)"> </span>=3D<span style=3D"color:rgb(192,192,1=
92)"> </span><span style=3D"color:rgb(0,103,124)">cryptSetAttributeString</=
span>(<span style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:r=
gb(9,46,100)">cryptSession</span>,<span style=3D"color:rgb(192,192,192)"> <=
/span><span style=3D"color:rgb(128,0,128)">CRYPT_SESSINFO_PASSWORD</span>,<=
/pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(9,46,100)">c_password</span>,<spa=
n style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,103,1=
24)">strlen</span>(<span style=3D"color:rgb(9,46,100)">c_password</span>)<s=
pan style=3D"color:rgb(192,192,192)"> </span>);</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(128,128,0)">if</span>(<span style=
=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,0,128)">cryp=
tStatusError</span>(<span style=3D"color:rgb(192,192,192)"> </span><span st=
yle=3D"color:rgb(9,46,100)">status</span><span style=3D"color:rgb(192,192,1=
92)"> </span>)<span style=3D"color:rgb(192,192,192)"> </span>)</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span>{</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">        </span><span style=3D"color:rgb(0,103,124)">cryptDestroySessi=
on</span>(<span style=3D"color:rgb(192,192,192)"> </span><span style=3D"col=
or:rgb(9,46,100)">cryptSession</span><span style=3D"color:rgb(192,192,192)"=
> </span>);</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">        </span><span style=3D"color:rgb(0,0,128)">qDebug</span>()<spa=
n style=3D"color:rgb(192,192,192)"> </span>&lt;&lt;<span style=3D"color:rgb=
(192,192,192)"> </span><span style=3D"color:rgb(0,128,0)">&quot;Couldnt</sp=
an><span style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(=
0,128,0)">able</span><span style=3D"color:rgb(192,192,192)"> </span><span s=
tyle=3D"color:rgb(0,128,0)">to</span><span style=3D"color:rgb(192,192,192)"=
> </span><span style=3D"color:rgb(0,128,0)">input</span><span style=3D"colo=
r:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,128,0)">password</sp=
an><span style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(=
0,128,0)">to</span><span style=3D"color:rgb(192,192,192)"> </span><span sty=
le=3D"color:rgb(0,128,0)">the</span><span style=3D"color:rgb(192,192,192)">=
 </span><span style=3D"color:rgb(0,128,0)">session&quot;</span>;</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span>}</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(128,128,0)">else</span></pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span>{</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">        </span><span style=3D"color:rgb(0,0,128)">qDebug</span>()<spa=
n style=3D"color:rgb(192,192,192)"> </span>&lt;&lt;<span style=3D"color:rgb=
(192,192,192)"> </span><span style=3D"color:rgb(0,128,0)">&quot;Success&quo=
t;</span>;</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span>}</pre>
<pre style=3D"margin:0px;text-indent:0px"><br></pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(0,128,0)">/*</span><span style=3D=
"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,128,0)">Activat=
e</span><span style=3D"color:rgb(192,192,192)"> </span><span style=3D"color=
:rgb(0,128,0)">the</span><span style=3D"color:rgb(192,192,192)"> </span><sp=
an style=3D"color:rgb(0,128,0)">session</span><span style=3D"color:rgb(192,=
192,192)"> </span><span style=3D"color:rgb(0,128,0)">*/</span></pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(9,46,100)">status</span><span sty=
le=3D"color:rgb(192,192,192)"> </span>=3D<span style=3D"color:rgb(192,192,1=
92)"> </span><span style=3D"color:rgb(0,103,124)">cryptSetAttribute</span>(=
<span style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(9,4=
6,100)">cryptSession</span>,<span style=3D"color:rgb(192,192,192)"> </span>=
<span style=3D"color:rgb(128,0,128)">CRYPT_SESSINFO_ACTIVE</span>,<span sty=
le=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,0,128)">TR=
UE</span><span style=3D"color:rgb(192,192,192)"> </span>);</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(128,128,0)">if</span>(<span style=
=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,0,128)">cryp=
tStatusError</span>(<span style=3D"color:rgb(192,192,192)"> </span><span st=
yle=3D"color:rgb(9,46,100)">status</span><span style=3D"color:rgb(192,192,1=
92)"> </span>)<span style=3D"color:rgb(192,192,192)"> </span>)</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span>{</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">        </span><span style=3D"color:rgb(0,103,124)">cryptDestroySessi=
on</span>(<span style=3D"color:rgb(192,192,192)"> </span><span style=3D"col=
or:rgb(9,46,100)">cryptSession</span><span style=3D"color:rgb(192,192,192)"=
> </span>);</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">        </span><span style=3D"color:rgb(128,128,0)">if</span><span st=
yle=3D"color:rgb(192,192,192)"> </span>(<span style=3D"color:rgb(192,192,19=
2)"> </span><span style=3D"color:rgb(9,46,100)">status</span><span style=3D=
"color:rgb(192,192,192)"> </span>=3D<span style=3D"color:rgb(192,192,192)">=
 </span><span style=3D"color:rgb(0,0,128)">CRYPT_ERROR_WRONGKEY</span>)</pr=
e>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">            </span><span style=3D"color:rgb(0,0,128)">qDebug</span>()=
<span style=3D"color:rgb(192,192,192)"> </span>&lt;&lt;<span style=3D"color=
:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,128,0)">&quot;Couldnt=
</span><span style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:=
rgb(0,128,0)">able</span><span style=3D"color:rgb(192,192,192)"> </span><sp=
an style=3D"color:rgb(0,128,0)">to</span><span style=3D"color:rgb(192,192,1=
92)"> </span><span style=3D"color:rgb(0,128,0)">activate</span><span style=
=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,128,0)">sess=
ion&quot;</span><span style=3D"color:rgb(192,192,192)"> </span>&lt;&lt;<spa=
n style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(9,46,10=
0)">status</span>;</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span>}</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(128,128,0)">else</span></pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span>{</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">        </span><span style=3D"color:rgb(0,0,128)">qDebug</span>()<spa=
n style=3D"color:rgb(192,192,192)"> </span>&lt;&lt;<span style=3D"color:rgb=
(192,192,192)"> </span><span style=3D"color:rgb(0,128,0)">&quot;Session</sp=
an><span style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(=
0,128,0)">activated&quot;</span>;</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span>}</pre>
<pre style=3D"margin:0px;text-indent:0px"><br></pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(0,128,0)">/*</span><span style=3D=
"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,128,0)">Send</s=
pan><span style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb=
(0,128,0)">a</span><span style=3D"color:rgb(192,192,192)"> </span><span sty=
le=3D"color:rgb(0,128,0)">command</span><span style=3D"color:rgb(192,192,19=
2)"> </span><span style=3D"color:rgb(0,128,0)">to</span><span style=3D"colo=
r:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,128,0)">the</span><s=
pan style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,128=
,0)">remote</span><span style=3D"color:rgb(192,192,192)"> </span><span styl=
e=3D"color:rgb(0,128,0)">system</span><span style=3D"color:rgb(192,192,192)=
"> </span><span style=3D"color:rgb(0,128,0)">*/</span></pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(128,128,0)">char</span><span styl=
e=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(9,46,100)">co=
mmand</span>[<span style=3D"color:rgb(0,0,128)">30</span>]<span style=3D"co=
lor:rgb(192,192,192)"> </span>=3D<span style=3D"color:rgb(192,192,192)"> </=
span><span style=3D"color:rgb(0,128,0)">&quot;ls</span><span style=3D"color=
:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,128,0)">-l\r\n&quot;<=
/span>;</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(9,46,100)">status</span><span sty=
le=3D"color:rgb(192,192,192)"> </span>=3D<span style=3D"color:rgb(192,192,1=
92)"> </span><span style=3D"color:rgb(0,103,124)">cryptPushData</span>(<spa=
n style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(9,46,10=
0)">cryptSession</span>,<span style=3D"color:rgb(192,192,192)"> </span><spa=
n style=3D"color:rgb(9,46,100)">command</span>,<span style=3D"color:rgb(192=
,192,192)"> </span><span style=3D"color:rgb(0,103,124)">strlen</span>(<span=
 style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(9,46,100=
)">command</span><span style=3D"color:rgb(192,192,192)"> </span>),<span sty=
le=3D"color:rgb(192,192,192)"> </span>&amp;<span style=3D"color:rgb(9,46,10=
0)">bytesCopied</span><span style=3D"color:rgb(192,192,192)"> </span>);</pr=
e>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(128,128,0)">if</span>(<span style=
=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,0,128)">cryp=
tStatusOK</span>(<span style=3D"color:rgb(192,192,192)"> </span><span style=
=3D"color:rgb(9,46,100)">status</span><span style=3D"color:rgb(192,192,192)=
"> </span>)<span style=3D"color:rgb(192,192,192)"> </span>)</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span>{</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">        </span><span style=3D"color:rgb(128,128,0)">if</span>(<span s=
tyle=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(9,46,100)"=
>bytesCopied</span><span style=3D"color:rgb(192,192,192)"> </span>!=3D<span=
 style=3D"color:rgb(192,192,192)"> </span>(<span style=3D"color:rgb(192,192=
,192)"> </span><span style=3D"color:rgb(128,128,0)">int</span><span style=
=3D"color:rgb(192,192,192)"> </span>)<span style=3D"color:rgb(192,192,192)"=
> </span><span style=3D"color:rgb(0,103,124)">strlen</span>(<span style=3D"=
color:rgb(192,192,192)"> </span><span style=3D"color:rgb(9,46,100)">command=
</span><span style=3D"color:rgb(192,192,192)"> </span>)<span style=3D"color=
:rgb(192,192,192)"> </span>)</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">            </span><span style=3D"color:rgb(9,46,100)">status</span><=
span style=3D"color:rgb(192,192,192)"> </span>=3D<span style=3D"color:rgb(1=
92,192,192)"> </span>-<span style=3D"color:rgb(0,0,128)">1</span>;<span sty=
le=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,128,0)">/*=
</span><span style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:=
rgb(0,128,0)">Not</span><span style=3D"color:rgb(192,192,192)"> </span><spa=
n style=3D"color:rgb(0,128,0)">all</span><span style=3D"color:rgb(192,192,1=
92)"> </span><span style=3D"color:rgb(0,128,0)">data</span><span style=3D"c=
olor:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,128,0)">was</span=
><span style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,=
128,0)">processed</span><span style=3D"color:rgb(192,192,192)"> </span><spa=
n style=3D"color:rgb(0,128,0)">*/</span></pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">        </span><span style=3D"color:rgb(128,128,0)">else</span></pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">        </span>{</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">            </span><span style=3D"color:rgb(9,46,100)">status</span><=
span style=3D"color:rgb(192,192,192)"> </span>=3D<span style=3D"color:rgb(1=
92,192,192)"> </span><span style=3D"color:rgb(0,103,124)">cryptFlushData</s=
pan>(<span style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rg=
b(9,46,100)">cryptSession</span><span style=3D"color:rgb(192,192,192)"> </s=
pan>);</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">            </span><span style=3D"color:rgb(0,0,128)">qDebug</span>()=
<span style=3D"color:rgb(192,192,192)"> </span>&lt;&lt;<span style=3D"color=
:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,128,0)">&quot;Flushed=
</span><span style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:=
rgb(0,128,0)">Data&quot;</span>&lt;&lt;<span style=3D"color:rgb(192,192,192=
)"> </span><span style=3D"color:rgb(9,46,100)">status</span>;</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">        </span>}</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span>}</pre>
<pre style=3D"margin:0px;text-indent:0px"><br></pre>
<pre style=3D"margin:0px;text-indent:0px"><br></pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(0,128,0)">/*</span><span style=3D=
"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,128,0)">Read</s=
pan><span style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb=
(0,128,0)">back</span><span style=3D"color:rgb(192,192,192)"> </span><span =
style=3D"color:rgb(0,128,0)">the</span><span style=3D"color:rgb(192,192,192=
)"> </span><span style=3D"color:rgb(0,128,0)">response</span><span style=3D=
"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,128,0)">*/</spa=
n></pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(128,128,0)">int</span><span style=
=3D"color:rgb(192,192,192)"> </span>*<span style=3D"color:rgb(9,46,100)">ou=
tDataLength</span><span style=3D"color:rgb(192,192,192)"> </span>=3D<span s=
tyle=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,0,128)">=
0</span>,<span style=3D"color:rgb(192,192,192)"> </span><span style=3D"colo=
r:rgb(9,46,100)">outDataMaxLength</span><span style=3D"color:rgb(192,192,19=
2)"> </span>=3D<span style=3D"color:rgb(192,192,192)"> </span><span style=
=3D"color:rgb(0,0,128)">500</span>;</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(128,128,0)">char</span><span styl=
e=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(9,46,100)">ou=
tData</span>[<span style=3D"color:rgb(0,0,128)">499</span>];</pre>
<pre style=3D"margin:0px;text-indent:0px"><br></pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(9,46,100)">status</span><span sty=
le=3D"color:rgb(192,192,192)"> </span>=3D<span style=3D"color:rgb(192,192,1=
92)"> </span><span style=3D"color:rgb(0,103,124)">cryptPopData</span>(<span=
 style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(9,46,100=
)">cryptSession</span>,<span style=3D"color:rgb(192,192,192)"> </span><span=
 style=3D"color:rgb(9,46,100)">outData</span>,<span style=3D"color:rgb(192,=
192,192)"> </span><span style=3D"color:rgb(9,46,100)">outDataMaxLength</spa=
n>,<span style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(=
9,46,100)">outDataLength</span><span style=3D"color:rgb(192,192,192)"> </sp=
an>);</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(128,128,0)">if</span>(<span style=
=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,0,128)">cryp=
tStatusError</span>(<span style=3D"color:rgb(192,192,192)"> </span><span st=
yle=3D"color:rgb(9,46,100)">status</span><span style=3D"color:rgb(192,192,1=
92)"> </span>)<span style=3D"color:rgb(192,192,192)"> </span>)</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span>{</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">        </span><span style=3D"color:rgb(0,103,124)">cryptDestroySessi=
on</span>(<span style=3D"color:rgb(192,192,192)"> </span><span style=3D"col=
or:rgb(9,46,100)">cryptSession</span><span style=3D"color:rgb(192,192,192)"=
> </span>);</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">        </span><span style=3D"color:rgb(0,0,128)">qDebug</span>()<spa=
n style=3D"color:rgb(192,192,192)"> </span>&lt;&lt;<span style=3D"color:rgb=
(192,192,192)"> </span><span style=3D"color:rgb(0,128,0)">&quot;Error</span=
><span style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,=
128,0)">Reading</span><span style=3D"color:rgb(192,192,192)"> </span><span =
style=3D"color:rgb(0,128,0)">data&quot;</span><span style=3D"color:rgb(192,=
192,192)"> </span>&lt;&lt;<span style=3D"color:rgb(192,192,192)"> </span><s=
pan style=3D"color:rgb(9,46,100)">status</span>;</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span>}</pre>
<pre style=3D"margin:0px;text-indent:0px"><br></pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(0,128,0)">//cryptDestroySession(<=
/span><span style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:r=
gb(0,128,0)">cryptSession</span><span style=3D"color:rgb(192,192,192)"> </s=
pan><span style=3D"color:rgb(0,128,0)">);</span></pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(0,0,128)">qDebug</span>()<span st=
yle=3D"color:rgb(192,192,192)"> </span>&lt;&lt;<span style=3D"color:rgb(192=
,192,192)"> </span><span style=3D"color:rgb(0,128,0)">&quot;Return</span><s=
pan style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,128=
,0)">Value:&quot;</span>&lt;&lt;<span style=3D"color:rgb(9,46,100)">outData=
</span>;</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(0,0,128)">qDebug</span>()<span st=
yle=3D"color:rgb(192,192,192)"> </span>&lt;&lt;<span style=3D"color:rgb(192=
,192,192)"> </span><span style=3D"color:rgb(0,128,0)">&quot;Bytes</span><sp=
an style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:rgb(0,128,=
0)">Copied:&quot;</span>&lt;&lt;*<span style=3D"color:rgb(9,46,100)">outDat=
aLength</span>;</pre>
<pre style=3D"margin:0px;text-indent:0px"><br></pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(0,103,124)">cryptDestroySession</=
span>(<span style=3D"color:rgb(192,192,192)"> </span><span style=3D"color:r=
gb(9,46,100)">cryptSession</span><span style=3D"color:rgb(192,192,192)"> </=
span>);</pre>
<pre style=3D"margin:0px;text-indent:0px"><span style=3D"color:rgb(192,192,=
192)">    </span><span style=3D"color:rgb(0,103,124)">cryptEnd</span>();</p=
re><br></div><div>Regards,</div><div>Bharathinandhan R</div></div>

--0000000000004e8dd0056a7fd644--


--===============7513591499248312706==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KQ3J5cHRsaWIg
bWFpbGluZyBsaXN0CkNyeXB0bGliQG1ic2tzLmZyYW5rZW4uZGVBZG1pbmlzdHJhdGlvbiB2aWEg
TWFpbDogY3J5cHRsaWItcmVxdWVzdEBtYnNrcy5mcmFua2VuLmRlCkFyY2hpdmU6IGZ0cDovL2Z0
cC5mcmFua2VuLmRlL3B1Yi9jcnlwdC9jcnlwdGxpYi9hcmNoaXZlcy8KaHR0cDovL25ld3MuZ21h
bmUub3JnL2dtYW5lLmNvbXAuZW5jcnlwdGlvbi5jcnlwdGxpYgpQb3N0cyBmcm9tIG5vbi1zdWJz
Y3JpYmVkIGFkZHJlc3NlcyBhcmUgYmxvY2tlZCB0byBwcmV2ZW50IHNwYW0sIHBsZWFzZQpzdWJz
Y3JpYmUgaW4gb3JkZXIgdG8gcG9zdCBtZXNzYWdlcy4K

--===============7513591499248312706==--