Interview Philipp Crocoll: the Android platform consolidates Java and C #

Source: Internet
Author: User
Tags keepass 2 keepass yubikey yubikey neo

In this interview, we discussed topics related to keepass2android with open source developer Philipp Crocoll. Keepass2android not only features powerful password storage, but also a good example of using Java and C # in a single Android app.

InfoQ: Can you tell me what keepass2android was designed to solve?

Keepass 2 is a powerful password manager that I have been using for a long time. It has some good plugins, such as those that can be integrated into Chrome or a Firefox browser. I also use keepassdroid for password access on my phone. Unfortunately, it is now only possible to implement read access to the database (the original KeePass 1 also provides write functionality, but it does not help me much). As I use my phone more and more frequently, I want to create an account to store these passwords on my phone.

So, I started thinking about adding these features, and I decided to use mono Android to port the app to C #, and to implement the password database modification based on the source code of KeePass 2.

What is the difference between infoq:keepass2android and other password managers?

When my app was almost finished, Keepassdroid added a write-support feature (at least in beta mode). I decided to publish it anyway, because it already has some new features-including full compatibility with KeePass 2, browser integration, and Quickunlock. Quickunlock is an in-memory database technology (that is, the master password is not stored on the SD card). To be able to secure the user's database when the user loses the phone, a short password must be entered to unlock the database. This is much better than having to output a strong, long master password every time.

Since the original version, I have added a lot of new features: The user can enter the verification code using the keyboard (because the Clipboard in Android is not safe), for the PC version of the user, you can choose through WebDAV, FTP, SFTP, Dropbox, OneDrive or googledrive, etc. to synchronize the database. There are more "expert" features, such as using a one-time password (Yubikey Neo input via NFC, https://www.yubico.com/products/yubikey-hardware/yubikey-neo/) or support for the KeePass 2 placeholder system (http://keepass.info/help/base/placeholders.html).

On the one hand, I try to make it possible for people who don't have much experience to use it, and also want to offer choices for users who are concerned about security issues.

InfoQ: What language do you choose to use C # instead of Java in keepass2android?

Write encrypted files must be very careful: if you write a bit wrong, the file may become useless or unreadable. The user must be sure that their password database is intact! To ensure that no database is damaged, I decided to base the initial implementation of KeePass 2. Since KeePass 2 was written in C #, I evaluated the possibility of using this implementation on Android. This is my first time to contact Xamarin's Android Mono. I did some C # development in my early work and had a little experience in Android development. It seems like a very interesting thing to put these two things together. I am very eager for new knowledge, so it is a great choice for me. It turns out that Android Mono is a great platform: you can have both the. NET Framework and the power of the Java platform and Android libraries.

Another benefit is that you can include the Java library directly. In fact, I used Eclipse's better support for Android to complete part of the application written in Java (cloud storage, custom keyboards).

InfoQ: Will Java and C #代码整合到同一个应用中主要需要做哪些事情? Is this going well? Or have you met some major challenges?

The Xamarin team has done a lot of work around the integration of the two languages, including creating a binding library in. NET projects so that the Java library can be referenced. This produces some C # classes and interfaces that can be used to invoke Java code. These jobs are flawless and can even automatically convert common naming conventions and patterns. To give a simple example: "String Getpackagename ()" is converted to "string PackageName {get {...}}". and the handling of the event: "Setonclicklistener (...)" is automatically converted to "click + = ..." in C #.

For some simple interfaces, I haven't found any problems. If you want to bind some complex libraries, you usually need to do something manually as described in the following pages:

Http://docs.xamarin.com/guides/android/advanced_topics/java_integration_overview/binding_a_java_library_ (. Jar)/api_metadata_reference/.

With Java class bindings and interfacing with C #, it feels like using a C # library. The very few differences I see are that when you derive a class from Java.Lang.Object, you need to add such a line of code:

catch (Java.Lang.Exception e)

This line of code is necessary because when implementing an interface that was originally defined in Java, you need to pass the object of this class back to the Java code.

In my implementation of the code, this is the only place where "objects" are in two virtual machines, both of which have their own garbage collection mechanisms.

InfoQ: Would you consider using C # again for future Android projects?

I think the Android version of Mono is a tool in my toolset. Although it is powerful, it is not required, or it is not necessarily suitable for all projects.

The reason for using C # in Keepass2android is that it allows me to use a very powerful library (Keepass 2 code) in an Android app. Also, for every friend with a C # background, some good features of C # (LINQ, Lambdas, dynamic types, and so on), as well as the. NET Framework, are very good.

Another reason is the portability of Android Mono, which allows code to run on Android, IOS (they use Xamarin) and, of course, on Windows and Linux (using mono). But unfortunately, it also has a drawback. The--mono library adds some MB-sized app packages (different frameworks vary in size), resulting in a much slower build process than pure java.

For now, my app has been released from Visual Studio for more than 2 minutes. To alleviate this problem, I added build options for developers with fewer applications, faster build times, and I tried to develop some new features in external projects.

Also, the IDE's support for some Android-specific features is less than Eclipse or Android Studio, which slows down development.

For these reasons, I may decide whether to use the Mono Android version depending on the specific project.

Keepass2android can be obtained in CodePlex,GPLv3 license.

View English text: interview with Philipp Crocoll on java/c# integration for Android

Chinese Original: http://www.infoq.com/cn/news/2014/06/Keepass2Android

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.