A method of printing a security document having a security feature, the method including, receiving the security document, and encrypted identity data at least partially indicative of an identity of the security document. The identity is decrypting using a secret key associated with the public key, allowing a signature to be generated using the determined identity. The signature is a digital signature of at least part of the identity. The signature is used in generating coded data at least partially indicative of the identity of the security document and at least part of the signature. The coded data is then printed on the security document.