ECDSA - i can help with code

Advertisement

Ivan83
Joined:
Posts:
5
Location:
Russia, Moscow

ECDSA - i can help with code

Hi!

I wrote the code to work with ECDSA.
BSD License.
ECDSA can help with your project.

Reply with quote

Advertisement

Ivan83
Joined:
Posts:
5
Location:
Russia, Moscow

[url]<invalid hyperlink removed by admin>[/url]
[url]<invalid hyperlink removed by admin>[/url]


#include "ec.h"

...

size_t rsize;
uint8_t rnd[70], priv_key[70], pub_key_x[70], pub_key_y[70], sign_r[70], sign_s[70];
ec_curve_t curve;
/*  SHA-1("abc") = "a9993e364706816aba3e25717850c26c9cd0d89d" */ uint8_t hash_abc[20] = {0xa9, 0x99, 0x3e, 0x36, 0x47, 0x06, 0x81, 0x6a, 0xba, 0x3e, 0x25, 0x71, 0x78, 0x50, 0xc2, 0x6c, 0x9c, 0xd0, 0xd8, 0x9d};

/* Get curve params by name. */
if (0 != ec_curve_from_str(ec_curve_str_get_by_name((uint8_t*)"secp192r1", 9), &curve))
   return (-1);

/* Generating keys. */
memset(rnd, 173, sizeof(rnd));/* XXX rand!!! */
if (0 != ec_key_gen(rnd, sizeof(rnd), &curve, priv_key, pub_key_x, pub_key_y, &rsize))
   return (-1); /* Error! */

/* Sign */
memset(rnd, 73, sizeof(rnd));/* XXX rand!!! */
if (0 != ec_sign((uint8_t*)hash_abc, 20, priv_key, rsize, rnd, sizeof(rnd), &curve, sign_r, sign_s, &rsize))
   return (-1); /* Error! */

/* Verify */
if (0 != ec_verify(&curve, pub_key_x, pub_key_y, rsize, (uint8_t*)hash_abc, 20, sign_r, sign_s, rsize))
   return (-1); /* Error! */

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,453
Location:
Prague, Czechia

Ivan83 wrote:

Already written them: putty@projects.tartarus.org
They expect to see a patch for the putty, but I do not want to learn ssh protocol.
Ok, I see. Thanks for trying.

Reply with quote

Advertisement

Ivan83
Joined:
Posts:
5
Location:
Russia, Moscow

There are many different parameters of elliptic curves.
Some appeared in the work in 1998.
There are parameters of elliptic curves generated not in the United States .
There are Russian version where in the formulas are slightly different coefficients and parameters of their curves.
All formulas and algorithms have long existed and analyzing it is described how to generate the most options for elliptic curves .
However, 25519 appeared not long ago, the formula calculations there several others, and I have not seen this work on cryptanalysis " works of art" . And almost all implementations in assembler.
So if anyone does not believe it is 25519 . This is my personal opinion.

Reply with quote

Advertisement

Baebeca
Guest

Re: ECDSA - i can help with code

martin wrote:

Thanks for sharing your code. Could you contact PuTTY team and offer them help integrating this to PuTTY codebase?
https://www.chiark.greenend.org.uk/~sgtatham/putty/feedback.html

We will takeover the implementation then. Thanks.

@prikryl
Putty has released full SSH2-ECDSA support in there current nightly snapshot. (https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html)

I can't find SSH2-ECDSA support in your current version or in your project roadmap.
Is there any Status to SSH2-ECDSA support?

thanks so far!

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,453
Location:
Prague, Czechia

Re: ECDSA - i can help with code

Baebeca wrote:

I can't find SSH2-ECDSA support in your current version or in your project roadmap.
Is there any Status to SSH2-ECDSA support?
I'll look into it.
But note they deliberately did not include ECDSA into recent PuTTY 0.64 release. I'm sure there's a reason for that.

Reply with quote

Baebeca
Joined:
Posts:
4
Location:
Germany

Re: ECDSA - i can help with code

martin wrote:

I'll look into it.
Thanks!

martin wrote:

not include ECDSA into recent PuTTY 0.64 release. I'm sure there's a reason for that.
Yes, 0.65 are still in Test - ECDSA will be included in the next release

Reply with quote

synapt
Guest

With PuTTY having this in snapshots quite a few months now and puttygen even having a .ppk export option in what I assume they figure would be the proper import model for an ECDSA key, is there any chance of this actually being implemented soon in WinSCP or is there still a wait for it to come out in a 'Stable' PuTTY release?

Reply with quote

Advertisement

synapt
Guest

martin wrote:

Will check it. But in general I prefer waiting for a stable release.

I don't blame you, but PuTTY is pretty slow for new releases (0.64 came two years after 0.63, and that one two years after 0.62, possible 0.65 might be soon-ish with the ECDSA though I guess), though worth noting by all intents even 0.64 despite being the latest "stable" release is still technically a beta :P

But yeah it'd be cool to see some support for it if possible, so far I've had no issues with them in PuTTY alone across multiple distros so at the very least puttygen is creating the general details properly, I'd assume getting the .ppk it generates working in WinSCP wouldn't be too horrible?

Reply with quote

Advertisement

martin
Site Admin
martin avatar

Synapt wrote:

Any update on this? A fast glance at recent releases doesn't show anything.
There's still no PuTTY release with ECDSA support.

Reply with quote

dqdt
Joined:
Posts:
2

martin wrote:

Synapt wrote:

Any update on this? A fast glance at recent releases doesn't show anything.
There's still no PuTTY release with ECDSA support.

That's really a pity. Fortunately FileZilla is supporting ECDSA so I had to switch to it. It is really a shame that several SSH/SFTP-app-providers wait that long implementing that badly needed (for instance for embedded devices) ECDSA support.

Reply with quote

Baebeca
Joined:
Posts:
4
Location:
Germany

Re: ECDSA - i can help with code

martin wrote:

I'm sending you an email with a development version of WinSCP to the address you have used to register on this forum.

@prikryl
thanks so far!

Reply with quote

Advertisement

Baebeca
Joined:
Posts:
4
Location:
Germany

@prikryl

I've tested multiple Logins with a ECDSA-Key
All Logins works fine

thanks for Integration the new algo!

Reply with quote

Advertisement

You can post new topics in this forum