-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Huge amount of time (15 seconds and more) spent to Org.BoumcyCastle.Security.DotNetUtilities.GetRsaPublicKey(...) . #3
Comments
If this is an issue that only occurs on a specific platform, then it's going to have to be something the platform fixes. I would file a bug with Xamarin on this. If you file an issue with Xamarin, can you please post a link back here for tracking? Otherwise, if there's something that occurs on all platforms, I'd recommend a bug on the main bc-csharp repo as this portable version is tracking that as closely as possible. The only changes here are in support of multi-targeting. |
Hello Oren, glad to see you comment! I checked it again and see that problem occurs only on Android (can't check on iOS because I don't have one) plattform. On Windows it takes - I do more randomly runs, not simply multiple runs for single line - apprx. 471 milliseconds. The same game again on call to Mono.Security.X509.X509CertificateBuilder.Sign(RSA key). One remark - Windows programm is also running in x86 mode, because someone noted somewhere x64 should be much faster. So i use x86 to get comparative results. Because I'm very new on mobile development and don't really sure, where to fill the bug report, it would be very nice if you can do this. Many thanks for your help! -- Alex -- |
@Alex-DE-74 I don't think it is a bug. Your code is generating asymmetric RSA key pair and that is nondeterministic operation which might take not only seconds but minutes to complete. Its speed might also depend on the speed of RNG available in the target system which might be slow even in "fast emulator" depending on its uptime and available entropy sources. You might want to take a look at comments in mono source code:
|
@jariq Maybe. Of course you a right, the cryptosystem needs to gather "a lot of random noise" in order to generate strong secure key, etc... But why it is determimistic slow on Android (fast Emulator on Windows) and determimistic fast on Windows on the same machine? The next question - is it possible, especially for Mono.Security.X509.X509CertificateBuilder.Sign(RSA key) to speed it up? What me wonder, if use ssl-over-http (https) with a browser client must have, on mutually authentificated new connection, the same impact. So it would take very long time to make a connection. But that is not true. If nothing would help - it is not acceptable the user would wait a minute for connection - the only possibility is to build single-side authenticated (but not mutually authentificated) SSL-Connection. It is because Android device should not store and reuse same certificate for the next connection. What you think, it is ok in terms of connection security? |
Whether we look at it from the software point of view (different OSes) or from hardware point of view (emulator surely does not have all resources of host system) I don't think term "the same machine" is applicable to your emulator and your host system.
I don't think your browser generates new SSL client certificate/key for each connection. As far as I know mutually authenticated SSL connection usually uses pregenerated certificate/key on both server and client side. |
Hello and thanks for great project!
This issue may be a part of BouncyCastle PSL only, but it has a cross touch to Mono.Security also.
Steps to Reproduce
Current Behavior
I test on fast (with Intel HAX) Android Emulator running Oreo
The bold-marked line takes about 15 seconds.
All other parts are ok :)
Expected Behavior
On plain C# Programm it takes milliseconds, or lower, it's simply step over as expected.
On which platforms did you notice this
[ ] macOS
[ ] Linux
[ ] Windows
[ x ] Andoid Oreo 8.0 fast Emulator.
Version Used:
You can use
mono --version
or About dialog to obtain this information.-- Alex -
The text was updated successfully, but these errors were encountered: