imported everything from my branch (which is slightly harmless).
[mono.git] / mcs / class / corlib / System.Security.Cryptography / DSACryptoServiceProvider.cs
index b16370aa99cfa35ceb2f8e23c0ad3d236cd1a202..7e000fbdfcef3041192da69e35298b139885f963 100644 (file)
@@ -9,11 +9,7 @@
 // (C) 2002
 // Portions (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
 // Portions (C) 2003 Ben Maurer
-// (C) 2004 Novell (http://www.novell.com)
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.IO;
 using System.Globalization;
+using System.Runtime.InteropServices;
 
 using Mono.Security.Cryptography;
 
 namespace System.Security.Cryptography {
 
-#if NET_1_0
-       public class DSACryptoServiceProvider : DSA {
-#else
+#if NET_2_0
+       [ComVisible (true)]
+       public sealed class DSACryptoServiceProvider : DSA, ICspAsymmetricAlgorithm {
+#elif NET_1_1
        public sealed class DSACryptoServiceProvider : DSA {
+#else
+       public class DSACryptoServiceProvider : DSA {
 #endif
                private const int PROV_DSS_DH = 13;             // from WinCrypt.h
 
@@ -97,7 +96,7 @@ namespace System.Security.Cryptography {
                        persistKey = (parameters != null);
                        if (parameters == null) {
                                parameters = new CspParameters (PROV_DSS_DH);
-#if ! NET_1_0
+#if NET_1_1
                                if (useMachineKeyStore)
                                        parameters.Flags |= CspProviderFlags.UseMachineKeyStore;
 #endif
@@ -128,19 +127,22 @@ namespace System.Security.Cryptography {
                        get { return dsa.KeySize; }
                }
 
+#if !NET_2_0
                public override KeySizes[] LegalKeySizes {
                        get { return LegalKeySizesValue; }
                }
+#endif
 
                public bool PersistKeyInCsp {
                        get { return persistKey; }
                        set { persistKey = value; }
                }
 
-#if (NET_1_0 || NET_1_1)
-               internal
-#else
+#if NET_2_0
+               [ComVisible (false)]
                public 
+#else
+               internal
 #endif
                bool PublicOnly {
                        get { return dsa.PublicOnly; }
@@ -150,7 +152,7 @@ namespace System.Security.Cryptography {
                        get { return "http://www.w3.org/2000/09/xmldsig#dsa-sha1"; }
                }
 
-#if ! NET_1_0
+#if NET_1_1
                private static bool useMachineKeyStore = false;
 
                public static bool UseMachineKeyStore {
@@ -266,5 +268,30 @@ namespace System.Security.Cryptography {
                                persisted = true;
                        }
                }
+#if NET_2_0
+               // ICspAsymmetricAlgorithm
+
+               [MonoTODO ("call into KeyPairPersistence to get details")]
+               [ComVisible (false)]
+               public CspKeyContainerInfo CspKeyContainerInfo {
+                       get { return null; }
+               }
+
+               [MonoTODO ("call into CryptoConvert (doesn't currently support DSA)")]
+               [ComVisible (false)]
+               public byte[] ExportCspBlob (bool includePrivateParameters)
+               {
+                       throw new NotImplementedException ("CryptoConvert doesn't currently support DSA");
+               }
+
+               [MonoTODO ("call into CryptoConvert (doesn't currently support DSA)")]
+               [ComVisible (false)]
+               public void ImportCspBlob (byte[] rawData)
+               {
+                       if (rawData == null)
+                               throw new ArgumentNullException ("rawData");
+                       throw new NotImplementedException ("CryptoConvert doesn't currently support DSA");
+               }
+#endif
        }
 }