Thanks for your answer. The link that you have attached indicates how to create the public key, but I have solved this part. The problem resides in creating the private key using the modulus and private exponent (not to be confused with the public exponent that is used for the public key).