Fix RSA encryption/decryption with OAEP padding [#30572]
[mono.git] / mcs / class / referencesource / mscorlib / system / security / cryptography / pkcs1maskgenerationmethod.cs
index c48d26cb41a31530ca1c7d8cfa46445994949b98..cb2d19469e40c186004206a0e9e8a6cba26f94b4 100644 (file)
@@ -40,6 +40,10 @@ namespace System.Security.Cryptography {
 
         public override byte[] GenerateMask(byte[] rgbSeed, int cbReturn)
         {
+#if MONO
+            HashAlgorithm hash = HashAlgorithm.Create (HashNameValue);
+            return Mono.Security.Cryptography.PKCS1.MGF1 (hash, rgbSeed, cbReturn);
+#else
             HashAlgorithm hash = (HashAlgorithm) CryptoConfig.CreateFromName(HashNameValue);
             byte[] rgbCounter = new byte[4];
             byte[] rgbT = new byte[cbReturn];
@@ -60,6 +64,7 @@ namespace System.Security.Cryptography {
                 ib += hash.Hash.Length;
             }
             return rgbT;
+#endif
         }
     }
 }