I am not sure if I should ask this here or in Security Stackexchange perhaps.
In any event, I was recently working on RSA signatures using a TPM and came across an issue where I switched the padding scheme from RSASSA-PKCS1-v1_5 to RSASSA-PSS. I think this should not make a difference but I noticed one example in TSS.MSR (.NET TPM library) does not function anymore. I started an issue about it at https://github.com/microsoft/TSS.MSR/issues/109.
But I would like to check, if someone can share an opion, if there is a need to do or be mindful something obvious other than changing the padding scheme?
I think not, and this is implied also in parameters such as .NET RSA library, e.g. https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.rsasignaturepadding and how one can use it like
using(var rsaKey = RSA.Create(keySizeInBits: 2048))
{
byte[] message = /* Random data. */
var sig = rsaKey.SignData(message, HashAlgorithmName.SHA256, RSASignaturePadding.Pss);
}
I see from questions in https://security.stackexchange.com/questions/183179/what-is-rsa-oaep-rsa-pss-in-simple-terms, https://crypto.stackexchange.com/questions/77881/are-rsa-pss-parameters-standardized and elsewhere how the padding actually happens is more complicated. But assuming it is an implementation detail of the library and it seem to be that signature checks do not match or work, one conclusion is that one might need to go check various internal parameters in this TSS.NET library, such as padding. So, hence I'd like to ensure myself this conclusion is correct enough and there isn't perhaps something very obvious. As for an illustration: do not use SHA-256 or put salt size to be exactly nn explicitly (OK, this is probably an implementation detail one shouldn't care about usually).
Addendum:
This is written after accepting the excellent notes by Maarten Bodewes.
Switching the hashing from SHA-256 to SHA-1 did not remove the failure on verifying signature in the linked example. Though, as expected, the "nameSize", or digest, changed to 20 bytes. So if there were some "lingering defaults" not properly handled in the example or the library somewhere, this alone (maybe a partial solution) was not the reason for the failure of switching to RSASSA-PSS padding scheme.
The quest continues. :)