New tests.
[mono.git] / mcs / class / corlib / System.Security.Cryptography / RSACryptoServiceProvider.cs
index c3cf93d1a505384f0cf05eda0a5fe248b4139f0d..ef607bc5fd28b0274dfcca13685009223baf6f17 100644 (file)
@@ -29,6 +29,8 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !MOONLIGHT
+
 using System.IO;
 using System.Runtime.InteropServices;
 
@@ -36,12 +38,8 @@ using Mono.Security.Cryptography;
 
 namespace System.Security.Cryptography {
 
-#if NET_2_0
        [ComVisible (true)]
        public sealed class RSACryptoServiceProvider : RSA, ICspAsymmetricAlgorithm {
-#else
-       public sealed class RSACryptoServiceProvider : RSA {
-#endif
                private const int PROV_RSA_FULL = 1;    // from WinCrypt.h
 
                private KeyPairPersistence store;
@@ -152,13 +150,8 @@ namespace System.Security.Cryptography {
                        }
                }
 
-#if (NET_2_0)
                [ComVisible (false)]
-               public 
-#else
-               internal
-#endif
-               bool PublicOnly {
+               public bool PublicOnly {
                        get { return rsa.PublicOnly; }
                }
        
@@ -297,14 +290,8 @@ namespace System.Security.Cryptography {
                {
                        if (rgbHash == null)
                                throw new ArgumentNullException ("rgbHash");
-#if NET_2_0
                        // Fx 2.0 defaults to the SHA-1
                        string hashName = (str == null) ? "SHA1" : GetHashNameFromOID (str);
-#else
-                       if (str == null)
-                               throw new CryptographicException (Locale.GetText ("No OID specified"));
-                       string hashName = GetHashNameFromOID (str);
-#endif
                        HashAlgorithm hash = HashAlgorithm.Create (hashName);
                        return PKCS1.Sign_v15 (this, hash, rgbHash);
                }
@@ -313,10 +300,8 @@ namespace System.Security.Cryptography {
                // HashAlgorithm descendant
                public bool VerifyData (byte[] buffer, object halg, byte[] signature) 
                {
-#if NET_1_1
                        if (buffer == null)
                                throw new ArgumentNullException ("buffer");
-#endif
                        if (signature == null)
                                throw new ArgumentNullException ("signature");
 
@@ -335,14 +320,8 @@ namespace System.Security.Cryptography {
                                throw new ArgumentNullException ("rgbHash");
                        if (rgbSignature == null)
                                throw new ArgumentNullException ("rgbSignature");
-#if NET_2_0
                        // Fx 2.0 defaults to the SHA-1
                        string hashName = (str == null) ? "SHA1" : GetHashNameFromOID (str);
-#else
-                       if (str == null)
-                               throw new CryptographicException (Locale.GetText ("No OID specified"));
-                       string hashName = GetHashNameFromOID (str);
-#endif
                        HashAlgorithm hash = HashAlgorithm.Create (hashName);
                        return PKCS1.Verify_v15 (this, hash, rgbHash, rgbSignature);
                }
@@ -374,16 +353,15 @@ namespace System.Security.Cryptography {
                                persisted = true;
                        }
                }
-#if NET_2_0
                // ICspAsymmetricAlgorithm
 
-               [MonoTODO ("call into KeyPairPersistence to get details")]
+               [MonoTODO ("Always return null")]
+               // FIXME: call into KeyPairPersistence to get details
                [ComVisible (false)]
                public CspKeyContainerInfo CspKeyContainerInfo {
                        get { return null; }
                }
 
-               [MonoTODO ("call into CryptoConvert")]
                [ComVisible (false)]
                public byte[] ExportCspBlob (bool includePrivateParameters)
                {
@@ -400,14 +378,13 @@ namespace System.Security.Cryptography {
                        return blob;
                }
 
-               [MonoTODO ("call into CryptoConvert")]
                [ComVisible (false)]
-               public void ImportCspBlob (byte[] rawData)
+               public void ImportCspBlob (byte[] keyBlob)
                {
-                       if (rawData == null)
-                               throw new ArgumentNullException ("rawData");
+                       if (keyBlob == null)
+                               throw new ArgumentNullException ("keyBlob");
 
-                       RSA rsa = CryptoConvert.FromCapiKeyBlob (rawData);
+                       RSA rsa = CryptoConvert.FromCapiKeyBlob (keyBlob);
                        if (rsa is RSACryptoServiceProvider) {
                                // default (if no change are present in machine.config)
                                RSAParameters rsap = rsa.ExportParameters (!(rsa as RSACryptoServiceProvider).PublicOnly);
@@ -426,6 +403,8 @@ namespace System.Security.Cryptography {
                                }
                        }
                }
-#endif
        }
 }
+
+#endif
+