Android EncryptUtils

A set of classes to conceal credentials

Лицензия

Лицензия

Группа

Группа

com.github.gfx.util.encrypt
Идентификатор

Идентификатор

encrypt-utils
Последняя версия

Последняя версия

1.1.0
Дата

Дата

Тип

Тип

aar
Описание

Описание

Android EncryptUtils
A set of classes to conceal credentials
Ссылка на сайт

Ссылка на сайт

https://github.com/gfx/Android-EncryptUtils
Система контроля версий

Система контроля версий

https://github.com/gfx/Android-EncryptUtils

Скачать encrypt-utils

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.gfx.util.encrypt/encrypt-utils/ -->
<dependency>
    <groupId>com.github.gfx.util.encrypt</groupId>
    <artifactId>encrypt-utils</artifactId>
    <version>1.1.0</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.github.gfx.util.encrypt/encrypt-utils/
implementation 'com.github.gfx.util.encrypt:encrypt-utils:1.1.0'
// https://jarcasting.com/artifacts/com.github.gfx.util.encrypt/encrypt-utils/
implementation ("com.github.gfx.util.encrypt:encrypt-utils:1.1.0")
'com.github.gfx.util.encrypt:encrypt-utils:aar:1.1.0'
<dependency org="com.github.gfx.util.encrypt" name="encrypt-utils" rev="1.1.0">
  <artifact name="encrypt-utils" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.github.gfx.util.encrypt', module='encrypt-utils', version='1.1.0')
)
libraryDependencies += "com.github.gfx.util.encrypt" % "encrypt-utils" % "1.1.0"
[com.github.gfx.util.encrypt/encrypt-utils "1.1.0"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
com.android.support » support-annotations jar +

Модули Проекта

Данный проект не имеет модулей.

This library is obsolete. Use androidx.security.crypto.EncryptedSharedPreferences instead.


Android-EncryptUtils Build Status Coverage Status

This is a set of class libraries that provides a way to save credentials in Android devices.

Note that this is not perfectly secure because private keys could not be concealed so the attacker are able to decrypt data if they have the device and enough time. However, this library should prevent data from 10-minutes cracking.

Gradle Dependencies

dependencies {
    compile 'com.github.gfx.util.encrypt:android-encrypt-utils:2.0.0'
}

Encryption

This is a utility to encrypt and decrypt credentials. Encryption creates a private key from context's packag name and ANDROID_ID by default.

Encryption encryption = new Encryption(Encryption.getDefaultCipher() ,context);
String plainText = ...;
String encrypted = encryption.encrypt(plainText);
String decrypted = encryption.decrypt(encrypted);

assert plainText.equals(decrypted);

You can also specify a private key instead of a context.

byte[] privateKey = ...;
assert privateKey.length == 16; // you must ensure!
Encryption encryption = new Encryption(Encryption.getDefaultCipher(), privateKey);

EncryptedSharedPreferences

This is an implementation of SharedPreferences that encrypts data.

SharedPreferences prefs = new EncryptedSharedPreferences(Encryption.getDefaultCipher(), context);

prefs.editor()
    .putString("email", email)
    .putString("password", password)
    .apply();

HOW DATA ARE STORED

As SharedPreferences does, EncryptedSHaredPreferences saves data in XML and its values are encrypted in AES while its keys are just encoded in Base64 format.

The following content is an example of shared preferences file:

<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<map>
    <string name="Zm9v">WvfCT5pyTP9srHQxf5nKXxH7Cw==</string>
    <string name="YmFy">RpLGPJ736a9vctawIz9IbCBYeA==</string>
</map>

AUTHOR

FUJI Goro (gfx) gfuji@cpan.org

LICENSE

This is a free software licensed in Apache License 2.0. See LICENSE for details.

Версии библиотеки

Версия
1.1.0
1.0.0