a method for implementing private key protocols between two processing devices of which at least one is a portable storage medium . the devices are fitted with a digital processing circuit for performing modular calculation operations with a view to executing operations such as modular multiplication , the processing circuit is used to implement a private key encryption function consisting of a series of reversible operations comprising at least a combination of two operations , i . e . a modular calculation operation and a binary logic operation , and said function is applied either for encrypting or signing messages to be transmitted , or for decrypting received messages .