How does Clifford Cocks 'Non-Secret Encryption' work? 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 &lt; C_i &lt; 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?
The two last equations don't directly give you the value of $C_i$, they are telling you the values of the remainder of Ci when divided by $P$ and $Q$. You then use the Chinese Remainder Theorem with this information to produce the value of $C_i$ (modulo $N$) that you are looking for.

See en.wikipedia.org/wiki/Chinese_remainder_theorem (there is an algorithm for solving it for the case of two equations)