Skip to Content
oxcrypto

BIGN-256

Diffie-Hellman over the Belarusian STB 34.101.45 bign-curve256v1 curve.

from oxcrypto.exchange.bign import BIGN

alice = BIGN.P256.generate()
bob = BIGN.P256.generate()
shared = alice.exchange(bob.public_key())
assert shared == bob.exchange(alice.public_key())

BIGN has P256 (bign-curve256v1). exchange returns the 32-byte x-coordinate of the shared point in the little-endian octet order STB 34.101.45 uses. It is the Diffie-Hellman step that the STB 34.101.66 BAKE protocols build on; oxcrypto does not implement BAKE itself.

BIGN keys use the STB 34.101.45 encodings rather than SEC1, so they have their own classes:

KeyRawDER and PEM
BIGNPrivateKeyto_bytes(): 32-byte little-endian scalarto_der()/to_pem(): PKCS#8 with the bign-pubkey algorithm identifier, PBES2-encrypted when password is given
BIGNPublicKeyto_bytes(): 64-byte untagged pointto_der()/to_pem(): SubjectPublicKeyInfo

Load them with BIGN.P256.private_key_from_bytes, public_key_from_bytes, load_private_key_der, load_private_key_pem, load_public_key_der and load_public_key_pem. There is no SEC1 private key format and no compressed point form. Encrypted PKCS#8 keys are subject to the same key-derivation limits as ECDSA keys.

Upstream

CrateStandardMaturityAudit
bignp256 0.14.0STB 34.101.45 (curve), STB 34.101.66 (key agreement)Stable release, rust-version 1.85, builds with Rust 1.88No published audit

bignp256 is written to perform secret-dependent operations in constant time; oxcrypto has not verified this independently.

Tests use the STB 34.101.45 Table B.1 key pair and the PKCS#8 document from the bignp256 test suite. No published known-answer vector for BIGN Diffie-Hellman was found, so the shared secret is checked against the generator (the exchange with the public key of scalar 1 returns the x-coordinate of the Table B.1 public key) and for agreement between both parties.

See Key exchange for zeroization notes.

On this page