Updates referencesource to .NET 4.7
[mono.git] / mcs / class / referencesource / mscorlib / system / security / cryptography / asymmetricsignatureformatter.cs
1 // ==++==
2 // 
3 //   Copyright (c) Microsoft Corporation.  All rights reserved.
4 // 
5 // ==--==
6 // <OWNER>Microsoft</OWNER>
7 // 
8
9 //
10 // AsymmetricSignatureFormatter.cs
11 //
12
13 namespace System.Security.Cryptography {
14     using System;
15     using System.Diagnostics.Contracts;
16
17 [System.Runtime.InteropServices.ComVisible(true)]
18     public abstract class AsymmetricSignatureFormatter {
19         //
20         // protected constructors
21         //
22     
23         protected AsymmetricSignatureFormatter() {
24         }
25     
26         //
27         // public methods
28         //
29     
30         abstract public void SetKey(AsymmetricAlgorithm key);
31         abstract public void SetHashAlgorithm(String strName);
32     
33         public virtual byte[] CreateSignature(HashAlgorithm hash) {
34             if (hash == null) throw new ArgumentNullException("hash");
35             Contract.EndContractBlock();
36             SetHashAlgorithm(hash.ToString());
37             return CreateSignature(hash.Hash);
38         }
39         
40         abstract public byte[] CreateSignature(byte[] rgbHash);    
41     }    
42 }