Bug 53784 - RijndaelManaged.CreateEncryptor returns a ill-configured Crimson.CommonCrypto.FastCryptorTransform
Summary: RijndaelManaged.CreateEncryptor returns a ill-configured Crimson.CommonCrypto...
Status: RESOLVED INVALID
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: master
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-03-22 13:04 UTC by Rodrigo Guimaraes
Modified: 2017-03-24 12:04 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED INVALID

Description Rodrigo Guimaraes 2017-03-22 13:04:48 UTC
I have a shared MyCrypto class that is being used for a Xamarin.Droid and a Xamarin.iOS project. It basically goes like this:

public static RijndaelManaged myRijndael = new RijndaelManaged();
myRijndael.Key = aesKey; //aesKey is received by the constructor
myRijndael.GenerateIV();
myRijndael.BlockSize = 128;
myRijndael.Mode = CipherMode.CBC;
myRijndael.Padding = PaddingMode.None;
And then on the beginning of the Encrypt function I do:

ICryptoTransform encryptor = myRijndael.CreateEncryptor(myRijndael.Key, myRijndael.IV);

On Android, myRijndael.CreateEncryptor returns a System.Security.Cryptography.RijndaelManagedTransform that works perfectly and is correctly configured. On iOS, though, a Crimson.CommonCrypto.FastCryptoTransform object is returned, and it seems like this object ignores some of my configurations, such as the PaddingMode.
Comment 1 Manuel de la Peña [MSFT] 2017-03-23 16:34:27 UTC
Hello,

Could you please provide a test case that shows the bug in the returned class? Also, could you please provide the details of your environment?

The easiest way to get exact version information is to use the "Xamarin Studio" menu, "About Xamarin Studio" item, "Show Details" button and copy/paste the version informations (you can use the "Copy Information" button).
Comment 2 Rodrigo Guimaraes 2017-03-24 12:04:04 UTC
Sorry, a non-related bug was causing the initialization function not to be called. The bug is resolved.