Re: Fw: SILC client connection issue

Ivo Clarysse <[email protected]> Tue, 31 Mar 2009 11:43:14 +0200
Newsgroups gmane.network.silc.devel
Message-ID <[email protected]>
--===============1063693482==
Content-Type: multipart/alternative; boundary=0015174be18a20c8f5046667075c

--0015174be18a20c8f5046667075c
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

I had similar problems with silc-toolkit 1.1.9.

I would suggest to look at the version of the private key you imported.

silcpk.c:silc_pkcs_silc_export_private_key(..)

will always save a private key in with version SILC_PRIVATE_KEY_VERSION_1,
but

silcpk.c:silc_pkcs_silc_export_public_key(...)

will include an identifier with the actual version.

So, when you create a version 2 key pair, and save those keys using the
above mentioned silcpk.c functions, you end up with a private key in version
1, and a public key in version 2.

Signing with a version 1 key will generate a signature without OID.

When verifying the signature (using the version 2 public key), a signature
with OID is expected.  Since this is not present, the signature is treated
as invalid.

I worked around this by manually importing the private key, and explicitly
setting it as a version 2 key:

    [...]
       pkcs = silc_pkcs_find_algorithm("rsa", "pkcs1");  // WITH OID

        silc_privkey = silc_calloc(1, sizeof(*silc_privkey));
        silc_privkey->pkcs = pkcs;

        if (!pkcs->import_private_key(key_data, key_data_len,
                                &silc_privkey->private_key)) {
                fprintf(stderr, "Failed to import key\n");
                exit(1);
        }

        *pvt = silc_calloc(1, sizeof(**pvt));

        (**pvt).private_key = silc_privkey;
        (**pvt).pkcs = silc_pkcs_find_pkcs(SILC_PKCS_SILC);
    [...]


Best regards,

Ivo.

2009/3/31 Hansa <[email protected]>

>  Hi,
>
> I am developing SILC client in WindowsXP. I have compiled SILC toolkit
> 0.9.8 and it was working fine.
>
> But I want to upgrade so i used latest one (1.1.8 and 1.1.9) and I am not
> able to connect with SILC Server.
>
> I am just trying mybot test application for this testing. It gives me
> following error.
>
> Error during key exchange with x.x.x.x: Incorrect signature
>
> Can you pls give me quick help on this as I am running in tight condition.
>
> Thanks & Regards
> Hansa
>
>
>

--0015174be18a20c8f5046667075c
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

I had similar problems with silc-toolkit 1.1.9.<br><br>I would suggest to l=
ook at the version of the private key you imported.<br><br>silcpk.c:silc_pk=
cs_silc_export_private_key(..)<br><br>will always save a private key in wit=
h version SILC_PRIVATE_KEY_VERSION_1, but<br>
<br>silcpk.c:silc_pkcs_silc_export_public_key(...)<br><br>will include an i=
dentifier with the actual version.<br><br>So, when you create a version 2 k=
ey pair, and save those keys using the above mentioned silcpk.c functions, =
you end up with a private key in version 1, and a public key in version 2.<=
br>
<br>Signing with a version 1 key will generate a signature without OID.<br>=
<br>When verifying the signature (using the version 2 public key), a signat=
ure with OID is expected.=A0 Since this is not present, the signature is tr=
eated as invalid.<br>
<br>I worked around this by manually importing the private key, and explici=
tly setting it as a version 2 key:<br><br>=A0=A0=A0 [...]<br>=A0=A0=A0=A0=
=A0=A0 pkcs =3D silc_pkcs_find_algorithm(&quot;rsa&quot;, &quot;pkcs1&quot;=
);=A0 // WITH OID<br>
<br>=A0=A0=A0=A0=A0=A0=A0 silc_privkey =3D silc_calloc(1, sizeof(*silc_priv=
key));<br>=A0=A0=A0=A0=A0=A0=A0 silc_privkey-&gt;pkcs =3D pkcs;<br><br>=A0=
=A0=A0=A0=A0=A0=A0 if (!pkcs-&gt;import_private_key(key_data, key_data_len,=
<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0 &amp;silc_privkey-&gt;private_key)) {<br>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 fprintf(stderr, &quot;Failed =
to import key\n&quot;);<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ex=
it(1);<br>=A0=A0=A0=A0=A0=A0=A0 }<br><br>=A0=A0=A0=A0=A0=A0=A0 *pvt =3D sil=
c_calloc(1, sizeof(**pvt));<br><br>=A0=A0=A0=A0=A0=A0=A0 (**pvt).private_ke=
y =3D silc_privkey;<br>=A0=A0=A0=A0=A0=A0=A0 (**pvt).pkcs =3D silc_pkcs_fin=
d_pkcs(SILC_PKCS_SILC);<br>
=A0=A0=A0 [...]<br><br><br>Best regards,<br><br>Ivo.<br><br><div class=3D"g=
mail_quote">2009/3/31 Hansa <span dir=3D"ltr">&lt;<a href=3D"mailto:hansa@s=
altriver.com">[email protected]</a>&gt;</span><br><blockquote class=3D"gm=
ail_quote" style=3D"border-left: 1px solid rgb(204, 204, 204); margin: 0pt =
0pt 0pt 0.8ex; padding-left: 1ex;">






<div bgcolor=3D"#ffffff">
<div><font face=3D"Arial" size=3D"2">Hi,</font></div>
<div><font face=3D"Arial" size=3D"2"></font>=A0</div>
<div><font face=3D"Arial" size=3D"2">I am developing SILC client in Windows=
XP. I have=20
compiled SILC toolkit 0.9.8 and it was working fine.</font></div>
<div><font face=3D"Arial" size=3D"2"></font>=A0</div>
<div><font face=3D"Arial" size=3D"2">But I want to upgrade so i used latest=
 one (1.1.8=20
and 1.1.9) and I am not able to connect with SILC Server.</font></div>
<div><font face=3D"Arial" size=3D"2"></font>=A0</div>
<div><font face=3D"Arial" size=3D"2">I am just trying mybot test applicatio=
n for this=20
testing. It gives me following error.</font></div>
<div><font color=3D"#ff0000" face=3D"Arial" size=3D"2"></font>=A0</div>
<div><font color=3D"#ff0000" face=3D"Arial" size=3D"2">Error during key exc=
hange with=20
x.x.x.x: Incorrect signature</font></div>
<div><font color=3D"#ff0000" face=3D"Arial" size=3D"2"></font>=A0</div>
<div><font face=3D"Arial" size=3D"2">Can you pls give me quick help on this=
 as I am=20
running in tight condition.</font></div>
<div><font color=3D"#ff0000" face=3D"Arial" size=3D"2"></font>=A0</div>
<div><font face=3D"Arial" size=3D"2">Thanks &amp; Regards</font></div>
<div><font face=3D"Arial" size=3D"2">Hansa</font></div></div>
<br><br></blockquote></div><br>

--0015174be18a20c8f5046667075c--

--===============1063693482==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________________________________
Info:    https://lists.silcnet.org/mailman/listinfo/silc-announce
Archive: https://lists.silcnet.org/pipermail/silc-announce
FAQ:     http://silcnet.org/support/faq/
--===============1063693482==--