THIS ANSWER APPLIES TO VERSION 6 OF THE QUESTION. It does not apply to version 11 which uses a different class of curves, with $p$ such that the curve's order is $p+1$.
We assume an elliptic curve $y^2=x^3+b$ over the field $\mathbb F_p$, with $p$ prime such that $p\bmod3=1$, and $b$ such that $b^{(p-1)/3}\bmod p=1$, and such that the corresponding elliptic curve group $G$ has order $h⋅n$ with $n$ prime and the cofactor $h=4$. Up to version 6, the question used such parameters: $p=157$, $b=2$, $n=43$.
Without proof: the group $G$ is the product of the cyclic group $\mathbb Z/n\mathbb Z$ of prime order $n$, and of the Klein 4 group $K_4$, which group law is:
$$\begin{array}{c|cccc}
+&0&u&v&w\\
\hline
0&0&u&v&w\\
u&u&0&w&v\\
v&v&w&0&u\\
w&w&v&u&0\\
\end{array}$$
Elements of $G$ can be classified according to their order, as:
- $1$ neutral/point at infinity $\mathcal O$, of order $1$. It's component in $\mathbb Z/n\mathbb Z$ and $K_4$ are $0$.
- $3$ points of order $2$, of coordinate $(x,0)$ with $x$ one of the three $x$ with $x^3+b\bmod p=0$. They are the elements of $G$ which component in $\mathbb Z/n\mathbb Z$ is $0$, and component in $K_4$ is $\ne0$.
- $n-1$ points of order $n$, forming (with $\mathcal O$) a uniquely defined subgroup $H$ of order $n$. They are the elements of $G$ which component in $\mathbb Z/n\mathbb Z$ is $\ne0$, and component in $K_4$ is $0$.
- $3⋅n-3$ points of order $2⋅n$. They are the elements of $G$ which components in $\mathbb Z/n\mathbb Z$ and $K_4$ are $\ne0$.
Notice that $\forall P\in G,\,(2⋅n)∗P=\mathcal O$. Also, if $P$ has order $2⋅n$, then $2*P$ has order $n$ and is a generator of $H$, and $n*P$ has order $2$.
In order to meet the question's "Verification Requirements", the question's $k$ must be odd. Proof by contraposition:
- Assume $k$ is not odd, and the verification requirements are met.
- Write $k$ as $k=2⋅j$. VR3 becomes $B′=(2⋅j)∗A′$
- The second part of VR1 tells $n∗B′\ne\mathcal O$
- Substitution yields that $n∗((2⋅j)∗A′)\ne\mathcal O$
- Rearranging yields $j*((2⋅n)∗A′)\ne\mathcal O$, using associativity and commutativity of integer multiplication $⋅$, and that $\forall u,v\in\mathbb Z,\,\forall X\in G,\, (u⋅v)*X=u*(v*X)$
- $(2⋅n)∗A′$ is $\mathcal O$ due to the aforementioned structure of $G$
- Substitution yields that $j*\mathcal O\ne\mathcal O$, which is false. Hence the original assumption is false.
More generally, in order to meet VR1 and VR3, $k$ must be coprime with the order of $G$.
For the "cofactor clearing function", we can pick any even $c$ coprime with $n$ and define function $g_c$ by $g_c(P)=c*P$. That $g_c$ is linear, and such that $\forall P\in G,\,g_c(P)\in H$. $c=2$ is the simplest. Another interesting choice is $c=n+1$, yielding function $\dot g$ with $\dot g(P)=(n+1)*P$, which has the property $\forall P\in H,\,\dot g(P)=P$. This cofactor clearing function $\dot g$ is projection on $H$, clearing the Klein Four-Group component of the input.
For the desired "inverse cofactor clearing function" $f$ such that $\forall P\in H,\,g(f(P))=P$, we can pick an element $S$ of order $2⋅n$, and construct $A$ from $S$ using our cofactor clearing function. Our $f$ will map $A$ to $S$, which passes the first requirement. Then the required linearity for $f$ (VR3) dictates what $f$ must do for many other inputs.
Here is Sage code for this:
p,b = 157,2 # parameters for the curve
assert p in Primes() and p%3 == 1 and pow(-b,(p-1)//3,p) == 1
G = EllipticCurve(GF(p),[0,b]) # define the parent group
ordG = G.order() # parent group order
n = factor(ordG)[-1][0] # order of H
assert ordG == 4*n # check cofactor is 4
O = G(0,1,0) # the neutral / point at infinity
c = n+1 # cofactor clearing by projection (or c = 2)
ordS = 2*n # desired order for S
for S in G.points(): # search S
if S.order()==ordS:
break
A = c*S # decide A
assert A.order() == n # check the order of A (and H) is n
print("p =",p," b =",b," n =",n," c =",c," A =",A.xy()," S =",S.xy())
def clearing(P): # our clearing function
return c*P # multiply by an even constant coprime with n
def revclear(P): # our reverse clearing function
Q,R = A,S # A is to Q what S is to R..
while Q != P: # and throughout our search..
Q,R = Q+A,R+S # that remains, insuring linearity
return R # result found!
A2 = revclear(A) # find A'
for k in range(1,n,2): # check each possible (odd) k
B = k*A # build B from k as specified
B2 = revclear(B) # find B'
assert clearing(B2) == B, "revclear fails to reverse clearing"
assert n*B2 != O # requirement 1
assert ordG*B2 == O # requirement 2 (a tautology)
assert B2 == k*A2 # requirement 3
print("all good")
The above matches the letter of "keeping the scalar $k$ preserved (and unknown)" prescription of the question: the function revclear
is not given access to k
.
However my revclear
performs in the order of $\Theta(n)$ operations. I could reduce that to $\Theta(\sqrt n)$ (and make it less apparent that revclear
sorts of finds $k$). Problem is, that's impractical for applications of cryptographic interest, where $n$ must be like 200-bit or higher. This answer proves that there is little hope to find a practical method (note: this answer's $h$ is my $n$ rather than the $h=4$ in the question).