This will help you partially:
string oidString = CryptoConfig.MapNameToOID(hashName);
Then you just need to insert it into the SEQUENCE header ( 30<length>30<length2><oid>050004<hashlength> ).
Of course, if you want to create an RSA PKCS # 1 v1.5 signature, you would be better off using RSAPKCS1SignatureFormatter .
EDIT: A few more details:
The ASN.1 you want to encode is as follows:
DigestInfo ::= SEQUENCE { digestAlgorithm AlgorithmIdentifier, digest OCTET STRING }
Where
AlgorithmIdentifier ::= SEQUENCE { algorithm OBJECT IDENTIFIER, parameters ANY DEFINED BY algorithm OPTIONAL }
So, to start from the inside out: digest-AlgorithmIdentifier consists of SEQUENCE -tag (30), length (we'll get back to that), OID and some parameters. The OID for fx SHA-1 is 1.3.14.3.2.26, which is encoded as 06 05 2b 0e 03 02 1a (OID tag 06, length 5 and OID encoding). All regular hash functions have NULL as parameters, which are encoded as 05 00 . Thus, the AlgorithmIdentifier contains 9 bytes - this is higher.
Now we can continue with the rest of DigestInfo: OCTET STRING, which contains the hash value. SHA-1 20 bytes hash will be encoded as 04 20 <HASH> .
DigestInfo content length is now 11 + 22 bytes (). We need to run DigestInfo using the SEQUENCE -tag, so in the end we get: 30 21 30 09 06 05 2b 0w 02 01 1a 05 00 04 20 <HASH> .
If you need to generate it yourself, you should now see that length2 = encodedOid.Length + 2 and length = length2 + 2 + 2 + hashlength.
If you need more information about ASN.1 encoding, I can recommend the Burt Kaliski Layman Guide for a subset of ASN.1, BER, and DER .