I'm trying to use System.Security.Cryptography (targeted framework .NET 4.5) to create xml digital signatures, so far I managed to create and verify signatures using the following scheme : RSA PKCS#1 v1.5 and SHA-256: http://www.w3.org/2001/04/xmldsig-more#rsa-sha256
However, I'm not able to use the following scheme: ‘RSASSA-PSS without parameters using SHA-256’ [RFC6931]: http://www.w3.org/2007/05/xmldsig-more#sha256-rsa-MGF1
The error being displayed is clear "SignatureDescription could not be created for the signature algorithm supplied."
For 'RSA PKCS#1 v1.5 and SHA-256' I added the following public class as its signature:
public class RSAPKCS1SHA256SignatureDescription : SignatureDescription
{
public RSAPKCS1SHA256SignatureDescription()
{
base.KeyAlgorithm = "System.Security.Cryptography.RSACryptoServiceProvider";
base.DigestAlgorithm = "System.Security.Cryptography.SHA256Managed";
base.FormatterAlgorithm = "System.Security.Cryptography.RSAPKCS1SignatureFormatter";
base.DeformatterAlgorithm = "System.Security.Cryptography.RSAPKCS1SignatureDeformatter";
}
public override AsymmetricSignatureDeformatter CreateDeformatter(AsymmetricAlgorithm key)
{
AsymmetricSignatureDeformatter asymmetricSignatureDeformatter = (AsymmetricSignatureDeformatter)
CryptoConfig.CreateFromName(base.DeformatterAlgorithm);
asymmetricSignatureDeformatter.SetKey(key);
asymmetricSignatureDeformatter.SetHashAlgorithm("SHA256");
return asymmetricSignatureDeformatter;
}
}
However, I have no clue whether ‘RSASSA-PSS without parameters using SHA-256’ is supported by .Net 4.5 and if so how to set its signature definition.
I would be really thankful if anyone had similar experience and can provide some help.