]> Cypherpunks.ru repositories - pygost.git/blobdiff - pygost/stubs/pygost/gost3410.pyi
Use curve's cofactor during VKO calculations
[pygost.git] / pygost / stubs / pygost / gost3410.pyi
index 84028df4b85912fbc0b3fd4424ab63b49905e490..4be8b1d63ecd13653a46cfac7271f56a342483f3 100644 (file)
@@ -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]
+MODE2SIZE = ...  # type: Dict[int, int]
 PublicKey = Tuple[int, int]
 
 
@@ -13,22 +15,39 @@ 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]: ...
+
 
-def public_key(curve: GOST3410Curve, private_key: int) -> PublicKey: ...
+def public_key(curve: GOST3410Curve, prv: int) -> PublicKey: ...
 
 
 def sign(
-    curve: GOST3410Curve,
-    private_key: int,
-    digest: bytes,
-    size: int=...,
+        curve: GOST3410Curve,
+        prv: int,
+        digest: bytes,
+        rand: bytes=None,
+        mode: int=...,
 ) -> bytes: ...
 
 
@@ -37,14 +56,20 @@ def verify(
     pub: PublicKey,
     digest: bytes,
     signature: bytes,
-    size: int=...,
+    mode: int=...,
 ) -> bool: ...
 
 
-def prv_unmarshal(private_key: bytes) -> int: ...
+def prv_unmarshal(prv: bytes) -> int: ...
+
+
+def pub_marshal(pub: PublicKey, mode: int=...) -> bytes: ...
+
+
+def pub_unmarshal(pub: bytes, mode: int=...) -> PublicKey: ...
 
 
-def pub_marshal(pub: PublicKey, mode: int) -> bytes: ...
+def uv2xy(curve: GOST3410Curve, u: int, v: int) -> Tuple[int, int]: ...
 
 
-def pub_unmarshal(pub: bytes, mode: int) -> PublicKey: ...
+def xy2uv(curve: GOST3410Curve, x: int, y: int) -> Tuple[int, int]: ...