The problem should be in the string you are sending, which should be badly formatted, try to do the following, first format your string following the documentation of the prefecture, gets more or less as below, and beware, iisretido has to be with S or N and not 0 or 1, if you look at the documentation for type of Rps, etc.:
char pad = '0';
string strDeAssinatura = tpRPS.ChaveRPS.InscricaoPrestador.ToString().PadLeft(8, pad) +
tpRPS.ChaveRPS.SerieRPS.PadRight(5, ' ') +
tpRPS.ChaveRPS.NumeroRPS.ToString().PadLeft(12, pad) +
tpRPS.DataEmissao.ToString("yyyyMMdd").PadLeft(8, pad) +
tpRPS.TributacaoRPS.ToString() +
tpRPS.StatusRPS.ToString() +
iisRetido +
tpRPS.ValorServicos.ToString("N2", _enUS).Replace(".", "").ToString().PadLeft(15, pad) +
tpRPS.ValorDeducoes.ToString("N2", _enUS).Replace(".", "").ToString().PadLeft(15, pad) +
tpRPS.CodigoServico.ToString().PadLeft(5, pad) +
tomadorTipo +
tpRPS.CPFCNPJTomador.Item.PadLeft(14, pad);
Then just sign this string, you can use the function below to do this:
Then play the value in tpRPS.Subscription and ready.
Good luck.
private byte[] Assinatura(string strDeAssinatura)
{
KeyInfo keyInfo = new KeyInfo();
KeyInfoX509Data keyInfoData = new KeyInfoX509Data(_cert);
RSACryptoServiceProvider rsaprovider = (RSACryptoServiceProvider)_cert.PublicKey.Key;
keyInfo.AddClause(keyInfoData);
RSACryptoServiceProvider rsaKey = _cert.PrivateKey as RSACryptoServiceProvider;
RSAPKCS1SignatureFormatter RSAFormatter = new RSAPKCS1SignatureFormatter(rsaKey);
RSAFormatter.SetHashAlgorithm("SHA1");
SHA1Managed SHhash = new SHA1Managed();
byte[] SignedHashValue = RSAFormatter.CreateSignature(SHhash.ComputeHash(new ASCIIEncoding().GetBytes(strDeAssinatura)));
return SignedHashValue;
}