Expand description
GOST R 34.10-2018 (256-bit) digital signatures — HLS mechanism 10.
No mature Rust crate implements the GOST elliptic-curve signature scheme, so
it is provided here from scratch over the curve mandated by the DLMS GOST
profile: id-tc26-gost-3410-2012-256-paramSetB, OID 1.2.643.7.1.2.1.1.2
(Р 1323565.1.024-2019, cryptographic suite 9). The message digest is
Streebog-256 (GOST R 34.11-2018).
During the HLS handshake (Р 1323565.1, §7.5.3) the signed message is
SystemTitle-a ‖ SystemTitle-b ‖ challenge_a ‖ challenge_b; each party signs
with its own signing key d_sign and verifies the peer’s response with the
peer’s verification key Q_sign.
Keys and signatures use the profile’s fixed-width big-endian encodings:
d_sign is Vec256(d) (32 octets), the verification key is
π_x(Q) ‖ π_y(Q) (64 octets), and a signature is Vec256(r) ‖ Vec256(s)
(64 octets), matching GOST R 34.10 and the control examples in Р 1323565.1.
Structs§
- Curve 🔒
- Curve parameters of
id-tc26-gost-3410-2012-256-paramSetB.
Enums§
- Gost
Error - Errors from GOST signing or verification.
Functions§
- curve 🔒
- gost_
sign - Signs
messagewith signing keyd, drawing a randomkfrom a secure RNG. - gost_
sign_ with_ k - Signs
messagewith signing keyd(32-octet big-endianVec256) using a caller-suppliedk(32 octets,1 ≤ k < q). ReturnsVec256(r) ‖ Vec256(s). - gost_
verify - Verifies signature
sig(Vec256(r) ‖ Vec256(s), 64 octets) overmessagewith verification keyq_pub(π_x(Q) ‖ π_y(Q), 64 octets). - hash_
to_ 🔒int - Streebog-256 digest of
messageas an integer. GOST R 34.10 maps the hash vector to the integer α with the first digest octet least significant. - hexint 🔒
- int_le 🔒
- Decodes a little-endian
Vec256scalar/coordinate. - kdf_
tree - KDF_TREE_GOSTR3411_2012_256 (R 50.1.113-2016 / RFC 7836) with a one-octet
counter (
R = 1). - mod_sub 🔒
- modinv 🔒
- Modular inverse of
xmodm(m prime, x != 0). - point_
add 🔒 - Point addition on the short-Weierstrass curve
y^2 = x^3 + a·x + b (mod p). - point_
mul 🔒 - Scalar multiplication
k·pointby double-and-add. - public_
key - Derives the verification key
π_x(Q) ‖ π_y(Q)(64 octets) from a signing keyd(Vec256), whereQ = d·P. - vec256 🔒
- Encodes an integer as a 32-octet
Vec256. The DLMS GOST profile (Р 1323565.1) uses little-endian byte order for scalars, coordinates and signature components, unlike the big-endian mathematical notation of the GOST R 34.10 standard itself. - vko
- VKO_GOST3410_2012_256 key-agreement function (R 50.1.113-2016 / RFC 7836).
Type Aliases§
- Point 🔒
- Affine point on the curve;
Noneis the point at infinity.