I have read Clifford Cocks "A Note on 'Non-secret Encryption'" and thought I would try to implement this, but I don't seem to be able to get it to work. I'm obviously missing something.
From the paper:
The receiver picks 2 primes $P$, $Q$ satisfying the conditions:
i. $P$ does not divide $Q-1$.
ii. $Q$ does not divide $P-1$.
He then transmits $N = PQ$ to the sender.
The sender has a message, consisting of numbers $C_1, C_2,\dots, C_r$ with $0 < C_i < N$ He sends each, encoded as: $D_i$ where $D_i = C_i^N \mod N$.
To decode, the receiver finds, by Euclid's Algorithm, numbers $P\prime$, $Q\prime$ satisfying:
i. $P\cdot P\prime = 1 \pmod{Q - 1}$
ii. $Q\cdot Q\prime = 1 \pmod{P - 1}$
Then $C_i=D_i^{P\prime} \pmod Q$ and $C_i = D_i^{Q\prime}\pmod P$ and so $C_i$ can be calculated.
In my program I don't seem to be able to reverse back to the original message. I don't see how I can recover $C_i$ using this method? Do I need to combine the two calculations of $C_i$ in step 3?
Any ideas where I am going wrong?