public byte[] Decrypt(byte[] rgb, bool fOAEP)
        {
            if (rgb == null)
            {
                throw new ArgumentNullException("rgb");
            }
            this.GetKeyPair();
            if (rgb.Length > this.KeySize / 8)
            {
                throw new CryptographicException(Environment.GetResourceString("Cryptography_Padding_DecDataTooBig", (object)(this.KeySize / 8)));
            }
            if (!this.CspKeyContainerInfo.RandomlyGenerated && !CompatibilitySwitches.IsAppEarlierThanWindowsPhone8)
            {
                KeyContainerPermission            containerPermission = new KeyContainerPermission(KeyContainerPermissionFlags.NoFlags);
                KeyContainerPermissionAccessEntry accessEntry         = new KeyContainerPermissionAccessEntry(this._parameters, KeyContainerPermissionFlags.Decrypt);
                containerPermission.AccessEntries.Add(accessEntry);
                containerPermission.Demand();
            }
            byte[]        o           = (byte[])null;
            SafeKeyHandle pKeyContext = this._safeKeyHandle;

            byte[] pbEncryptedKey = rgb;
            int    length         = pbEncryptedKey.Length;
            int    num            = fOAEP ? 1 : 0;
            ObjectHandleOnStack objectHandleOnStack = JitHelpers.GetObjectHandleOnStack <byte[]>(ref o);

            RSACryptoServiceProvider.DecryptKey(pKeyContext, pbEncryptedKey, length, num != 0, objectHandleOnStack);
            return(o);
        }
 public byte[] Decrypt(byte[] rgb, bool fOAEP)
 {
     if (rgb == null)
     {
         throw new ArgumentNullException("rgb");
     }
     this.GetKeyPair();
     if (rgb.Length > this.KeySize / 8)
     {
         throw new CryptographicException(Environment.GetResourceString("Cryptography_Padding_DecDataTooBig", new object[]
         {
             this.KeySize / 8
         }));
     }
     if (!this.CspKeyContainerInfo.RandomlyGenerated && !CompatibilitySwitches.IsAppEarlierThanWindowsPhone8)
     {
         KeyContainerPermission            keyContainerPermission = new KeyContainerPermission(KeyContainerPermissionFlags.NoFlags);
         KeyContainerPermissionAccessEntry accessEntry            = new KeyContainerPermissionAccessEntry(this._parameters, KeyContainerPermissionFlags.Decrypt);
         keyContainerPermission.AccessEntries.Add(accessEntry);
         keyContainerPermission.Demand();
     }
     byte[] result = null;
     RSACryptoServiceProvider.DecryptKey(this._safeKeyHandle, rgb, rgb.Length, fOAEP, JitHelpers.GetObjectHandleOnStack <byte[]>(ref result));
     return(result);
 }