1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
4 
5 namespace System.Security.Cryptography.Xml
6 {
7     internal abstract class RSAPKCS1SignatureDescription : SignatureDescription
8     {
RSAPKCS1SignatureDescription(string hashAlgorithmName)9         public RSAPKCS1SignatureDescription(string hashAlgorithmName)
10         {
11             KeyAlgorithm = typeof(RSA).AssemblyQualifiedName;
12             FormatterAlgorithm = typeof(RSAPKCS1SignatureFormatter).AssemblyQualifiedName;
13             DeformatterAlgorithm = typeof(RSAPKCS1SignatureDeformatter).AssemblyQualifiedName;
14             DigestAlgorithm = hashAlgorithmName;
15         }
16 
CreateDeformatter(AsymmetricAlgorithm key)17         public sealed override AsymmetricSignatureDeformatter CreateDeformatter(AsymmetricAlgorithm key)
18         {
19             var item = (AsymmetricSignatureDeformatter)CryptoHelpers.CreateFromName(DeformatterAlgorithm);
20             item.SetKey(key);
21             item.SetHashAlgorithm(DigestAlgorithm);
22             return item;
23         }
24 
CreateFormatter(AsymmetricAlgorithm key)25         public sealed override AsymmetricSignatureFormatter CreateFormatter(AsymmetricAlgorithm key)
26         {
27             var item = (AsymmetricSignatureFormatter)CryptoHelpers.CreateFromName(FormatterAlgorithm);
28             item.SetKey(key);
29             item.SetHashAlgorithm(DigestAlgorithm);
30             return item;
31         }
32 
CreateDigest()33         public abstract override HashAlgorithm CreateDigest();
34     }
35 }
36