Luiz, para efetuar a assinatura preciso preencher sempre esses valores ?
private string calcularTagAssinatura()
{
// Acessa o Certificado
X509Certificate2 cert = new X509Certificate2(cert_filename, cert_password, X509KeyStorageFlags.MachineKeySet);
//Tags
string buffer = prestador.inscricaoMunicipal.PadLeft(8, '0'); // 00000000
buffer += "00001"; //serieRPS
buffer += id.ToString("D12"); //numeroRPS 000000000001
buffer += string.Format("{0:yyyyMMdd}", dataEmissao); //AAAAMMDD
buffer += tipoTributacaoRPS; //tipoTributacaoRPS T|F|A|B|M|N|X|V|P
buffer += status; //statusRPS N|C
buffer += (servicos.issRetido?"S":"N"); //issRetido S|N
buffer += (servicos.valorServicos*100).ToString("000000000000000"); //000000000000000
buffer += (servicos.valorDeducoes*100).ToString("000000000000000"); //000000000000000
buffer += (servicos.codigoServico).ToString("D5"); //00000
buffer += (tomador.documento.Length == 11 ? 1 : 2); //1 CPF, 2 CNPJ ou 3 N/D
buffer += (tomador.documento.PadLeft(14, '0')); //CPF ou CNPJ 00000000000000
//4070864000S0100000000003220160704TNN00000000000010000000000000000002876100003342547600
//12345678901234567890123456789012345678901234567890123456789012345678901234567890123456
// 1 2 3 4 5 6 7 8
//Assinatura
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
rsa = cert.PrivateKey as RSACryptoServiceProvider;
byte[] sAssinaturaByte = enc.GetBytes(buffer.ToString());
RSAPKCS1SignatureFormatter rsaf = new RSAPKCS1SignatureFormatter(rsa);
SHA1CryptoServiceProvider sha1 = new SHA1CryptoServiceProvider();
byte[] hash;
hash = sha1.ComputeHash(sAssinaturaByte);
rsaf.SetHashAlgorithm("SHA1");
sAssinaturaByte = rsaf.CreateSignature(hash);
string base64 = Convert.ToBase64String(sAssinaturaByte);
return base64;