How to sign a message using RSA? Assuming I already have a D, P, Q, etc of an RSA key: How do I now sign a message? If it matters – the message is around 100 bits.

I don't know much about cryptography, but I can get these numbers generated by a computer. Unfortunately, in my scenario – I can't use the built-in functions to use these numbers.
IMO implementing RSA yourself is a bad idea. While textbook signing is pretty easy, if you have access to a BigInteger class, you also need to get the padding right. In some use-cases timing attacks are also a problem.

But if you want to go that route, PKCS #1 is the standard you need to implement. It details how the padding should look like.

The text-book RSA signing operation is pretty easy, in principle. Just calculate $m^d \mod n$. Unfortunately without correct use of hashing and padding it's very insecure i.e. you can't use the actual message as $m$, but the padded hash of the message.



I'd look into mono's crypto code. They have purely managed implementations of most .net crypto classes. These should work even if you don't have access to the built in classes.

A few interesting looking classes:


All classes related to RSA in System.Security.Cryptography
RSAManaged


They use the MIT X11 license, which is a permissive open source license.