// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+#if !MOONLIGHT
+
using System.IO;
using System.Runtime.InteropServices;
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;
}
}
-#if (NET_2_0)
[ComVisible (false)]
- public
-#else
- internal
-#endif
- bool PublicOnly {
+ public bool PublicOnly {
get { return rsa.PublicOnly; }
}
{
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);
}
// 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");
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);
}
persisted = true;
}
}
-#if NET_2_0
// ICspAsymmetricAlgorithm
[MonoTODO ("Always return null")]
}
[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);
}
}
}
-#endif
}
}
+
+#endif
+