This crate is designed and developed specifically as a capstone project to Ukrainian Rust Community bootcamp.
Previous year when I was preparing my thesis for bachelor's degree with the theme "Truncating El-Gamal type digital signatures" and have to check my results with DSTU 4145-2002, but there are no available implementation of it on Rust. So, I have managed somehow to use specific library in C++, and done that successfully :). Mainly the idea originates from here.
I want to add to what has been said, that when I started implementing it a capstone project, realised, that we don't have any available library for using algebra over GF2^m, only for prime fields. So, in addition, I have also implemented that by myself.
It provides DSTU 4145-2002 implementation in Rust, but with some nuances:
- GOST hashing function is changed to SHA3-512 one;
- By now there is no support for normal basis arithmetic.
Moreover, with the DSTU implementation, you can use already Binary Elliptic Curve * over GF 2^m over some extension with polynomial basis but for specific polynomials. In addition to that
* - (p. 19, Koblitz curve with A = 0 or 1)
At this moment I can say that from standard DSTU 4145-2002 is implemented such a list of things:
- Interacting interface with
signature
crate (dstu4145-rust). - Working standard with usage of arithmetics in polynomial basis (poly_algebra).
- Choice between the EC's recommended parameters by Ukrainian government in (rust-ec).
- Affine EC points arithmetic.
- Common packing logic for signature and public key affine point on EC.
Examples of how to use the project can find in the crates documentation or in examples folder.
Actual implemented algorithm scheme is represented here. Necessary details can be found here.
With the passage of time, there are some plans to be done:
- Implement benchmarks.
- Find formulas for Koblitz projective coordinates points calculation.
- Implement projective EC coordinates calculation.
- Normal basis arithmetic calculation.
- ?Implement full packing of Public Key and Parameters into ASN1 structs?.
Interesting fact that it is available scheme for truncating DSTU 4145-2002 signatures regarding the same work of Tomas Pornin. And also, article publication in English (p. 10, 'Kripaka I., Yakovliev S.').