Android--6 a cryptographic tool

Source: Internet
Author: User

More and more hackers are eyeing mobile apps every day, because there are things in the mobile app that hackers are interested in, such as user data. Hard-coded (hard-coded, note, fixed write dead, cannot be modified) security keys, personal information stored in the SD card in plaintext, unencrypted stored usernames and passwords in the database, collected analytics (analytics) and sent to remote servers in clear text These situations make it easier to attack (succeed).

Using the Cryptography tool correctly protects our sensitive data and ensures privacy and data integrity. On the other hand, encryption is difficult and prone to misuse (cryptography is hard-to-use and easy-to-misuse). Note the easy-to-crack encryption Method (broken cryptography) (for example, using unsafe algorithms, or hard-coded keys to binary packages), consult List 2014, mobile 10 big risk. So, what lessons do you get from it? It is not advisable to encrypt without encryption, nor is it advisable to encrypt it properly (without mentioning the time spent).

In order to be able to make secure applications on the Android platform, we will now show you how to encrypt easily and securely.

First, a general introduction to some of the most common cryptographic libraries that can be integrated into Android applications. A cryptographic library is a collection of cryptographic tools that contain tools such as cryptographic algorithms, padding methods, and hash functions.

Bouncy Castle

The Inflatable Castle Corps (Legion of the bouncy Castle) is a charitable group from Australia, and they have written bouncy Castle this widely used class library. The library provides both a lightweight cryptographic API and a Java password extension (JCE) provider. The Android platform already has a streamlined old version of bouncy Castle (and some minor changes to fit the Android platform). The result is that any attempt to build and use the latest version of the Bouncycastle class library in your application will cause class load conflicts.

Spongy Castle

The motivation behind spongy Castle is to allow Android developers to use any version of the Bouncycastle class library in their applications. Spongycastle is the latest version of the Bouncycastle has been simply repackaged, all the org.bouncycastle.* package renamed in order to org.spongycastle.*, all Java security API provider name changed by BC For SC.

Openssl

OpenSSL is an open source toolkit that implements the SSL and TLS protocols as well as the common password vault. OpenSSL has been ported to many platforms, including Android. As an alternative, you can also build from source (using the Android NDK) and then bind to the application.

Now let's assume that you want to encrypt some data for the purposes of the application. Which encryption algorithm will you use, AES or DES? How long is your secret key, 128 or 256 bits? Which encryption mode will you use, ECB or CBC? If you have no answer to all of these questions, and there is no good reason, then you may find that you are in a delicate position, although you have all the tools you want, but you are not sure which one to use and how to use it.

This is the scene where the Idiot Cryptography Toolkit works. These toolkits do not implement any fancy encryption capabilities, nor do they attempt to replace any of the aforementioned cryptography libraries, instead they are built on these class libraries, with the sole purpose of making it easier and more secure to use encryption.

In contrast to the common cryptography library, these toolkits typically support only a subset of algorithms, patterns, structures, and parameters. For the parts that the universal encryption tool needs to set, these toolkits provide you with a reasonable default value in case you know what you want, but you don't know how to use it, or you only care about a safe solution at the end. Let's examine a few of these toolkits to better understand their running rules.

Keyczar

Keyczar is a set of open source toolkits originally developed by two Google security team members. It is implemented in Java,python and C + + languages. It supports two authentication methods: symmetric encryption and fee heap encryption. Keyczar provides secure default settings, including algorithms, secret key lengths and patterns, key loops and versioning, initial vector (vector) and authorization code generation, and internationalization support. The toolkit is built on JCE, (here) and uses the spongy castle security provider.

Aerogear Crypto

Aerogear Crypto is a small Java library provided by Aerogear. It supports authenticated symmetric encryption, elliptic curve encryption, and password-based key derivation. It also provides an explicit setting for the algorithm. Aerogear Crypto relies on spongy Castle on the Android platform and relies on bouncy Castle on other platforms. The library is also available on the Ios,windows Phone and Cordova.

Conceal

To enable the encryption and authentication of large files on SD cards quickly and with little memory, Facebook has developed conceal. The conceal can be either authenticated or encrypted, while the Key management feature is provided by default. It uses OpenSSL, but only contains the part that it needs, so it is only 85KB in size. The results published on the conceal site show that it is better than bouncy Castle.

The following table summarizes the cryptographic libraries described above. Note: All of the libraries described above can securely encrypt the encryption of new users, but advanced developers can not use these default practices and can specify all of the cryptographic details as they wish (as if they were using other cryptographic libraries).

Encrypt Library Development company License
Aerogear Crypto Aerogear Apache 2.0
Conceal Facebook Bsd
Keyczar – Apache 2.0
Summary (to sum up)

If you're a mobile app developer, you'll have to take the time to make your app easy to use, feature-rich and eye-catching, but don't forget to improve the security of your app. If you don't know how to get started, or worry about doing something wrong, choose one of the toolkits mentioned in this article so that you can start. Regardless of which encryption tool you decide to use, you should avoid implementing cryptographic algorithms and cryptographic protocols, and use only widely-used, universally accepted, tested algorithms and protocols.

Android--6 a cryptographic tool

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.