X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=pygost%2Fstubs%2Fpygost%2Fgost3410.pyi;h=ee0e9b6de227720e3dbd784e47bf726ef3aac1b0;hb=f3a3246bc9da027e0527b89204e1b95ed52af5c6;hp=9151e994e009b287ceabc9cfa275a3615b8549e7;hpb=34c9c9a4f95eecfee75fc36d75d2ee45d1054a25;p=pygost.git diff --git a/pygost/stubs/pygost/gost3410.pyi b/pygost/stubs/pygost/gost3410.pyi index 9151e99..ee0e9b6 100644 --- a/pygost/stubs/pygost/gost3410.pyi +++ b/pygost/stubs/pygost/gost3410.pyi @@ -2,7 +2,9 @@ from typing import Dict from typing import Tuple -CURVE_PARAMS = ... # type: Dict[str, Tuple[bytes, bytes, bytes, bytes, bytes, bytes]] +DEFAULT_CURVE = ... # type: GOST3410Curve +CURVES = ... # type: Dict[str, GOST3410Curve] +PublicKey = Tuple[int, int] class GOST3410Curve(object): @@ -12,41 +14,54 @@ class GOST3410Curve(object): b = ... # type: int x = ... # type: int y = ... # type: int + cofactor = ... # type: int + e = ... # type: int + d = ... # type: int def __init__( - self, p: bytes, q: bytes, a: bytes, b: bytes, x: bytes, y: bytes + self, + p: int, + q: int, + a: int, + b: int, + x: int, + y: int, + cofactor: int = 1, + e: int = None, + d: int = None, ) -> None: ... + def pos(self, v: int) -> int: ... + def exp(self, degree: int, x: int=..., y: int=...) -> int: ... + def st(self) -> Tuple[int, int]: ... -PublicKey = Tuple[int, int] + @property + def point_size(self) -> int: ... + + def contains(self, point: Tuple[int, int]) -> bool: ... + + +def public_key(curve: GOST3410Curve, prv: int) -> PublicKey: ... + + +def sign(curve: GOST3410Curve, prv: int, digest: bytes, rand: bytes=None) -> bytes: ... + + +def verify(curve: GOST3410Curve, pub: PublicKey, digest: bytes, signature: bytes) -> bool: ... + + +def prv_unmarshal(prv: bytes) -> int: ... -def public_key(curve: GOST3410Curve, private_key: int) -> PublicKey: ... +def pub_marshal(pub: PublicKey) -> bytes: ... -def kek( - curve: GOST3410Curve, - private_key: int, - ukm: bytes, - pubkey: PublicKey, -) -> bytes: ... +def pub_unmarshal(pub: bytes) -> PublicKey: ... -def sign( - curve: GOST3410Curve, - private_key: int, - digest: bytes, - size: int=..., -) -> bytes: ... +def uv2xy(curve: GOST3410Curve, u: int, v: int) -> Tuple[int, int]: ... -def verify( - curve: GOST3410Curve, - pubkeyX: int, - pubkeyY: int, - digest: bytes, - signature: bytes, - size: int=..., -) -> bool: ... +def xy2uv(curve: GOST3410Curve, x: int, y: int) -> Tuple[int, int]: ...