a161a6a186f59fda7436f49a8ff6520281006fac
[mono.git] / mcs / class / referencesource / System.Core / System / Security / Cryptography / ECDsa.cs
1 // ==++==
2 // 
3 //   Copyright (c) Microsoft Corporation.  All rights reserved.
4 // 
5 // ==--==
6
7 using System;
8
9 namespace System.Security.Cryptography {
10     /// <summary>
11     ///     Base class for implementations of elliptic curve DSA
12     /// </summary>
13     [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)]
14     public abstract class ECDsa : AsymmetricAlgorithm {
15         public override string KeyExchangeAlgorithm {
16             get { return null; }
17         }
18
19         public override string SignatureAlgorithm {
20             get { return "ECDsa"; }
21         }
22
23         //
24         // Creation factory methods
25         //
26
27         public static new ECDsa Create() {
28 #if MONO
29             throw new NotImplementedException ();
30 #else
31             return Create(typeof(ECDsaCng).FullName);
32 #endif
33         }
34
35         public static new ECDsa Create(string algorithm) {
36             if (algorithm == null) {
37                 throw new ArgumentNullException("algorithm");
38             }
39
40             return CryptoConfig.CreateFromName(algorithm) as ECDsa;
41         }
42
43         //
44         // Signature operations
45         //
46
47         public abstract byte[] SignHash(byte[] hash);
48         public abstract bool VerifyHash(byte[] hash, byte[] signature);
49     }
50 }