Coder Social home page Coder Social logo

数据库加密 about xutils3 HOT 5 CLOSED

yhsj0919 avatar yhsj0919 commented on July 23, 2024
数据库加密

from xutils3.

Comments (5)

247321453 avatar 247321453 commented on July 23, 2024 2
static class StringColumnConverter2 extends StringColumnConverter{
    @Override
    public String getFieldValue(Cursor cursor, int i) {
        return StringUtil.de(super.getFieldValue(cursor, i));
    }

    @Override
    public String fieldValue2DbValue(String s) {
        return StringUtil.en(s);
    }
}
static {
    ColumnConverterFactory.registerColumnConverter(String.class, new StringColumnConverter2());
}

加密和解密自己处理

from xutils3.

zhbzhbzhbz avatar zhbzhbzhbz commented on July 23, 2024 1

ColumnConverterFactory

在讨论群问了下,ColumnConverterFactory.registerColumnConverter是在Application里(App初始化时)调用

@zxlmickey 请问是说比如原来要加密的列是int,就改成其他自定义的数据类型?

from xutils3.

zhbzhbzhbz avatar zhbzhbzhbz commented on July 23, 2024 1

因为上述方案只能对列加密,还有一个方案是用SQLCipher来改造2.x版本的XUtils,https://blog.csdn.net/Tobi2015/article/details/51077314。
但是不知道怎么应用在3.x版本上

from xutils3.

zxlmickey avatar zxlmickey commented on July 23, 2024

搞懂了,把要加密的列设置一个自定义数据类型,然后使用ColumnConverter在读写时进行加密和解密

from xutils3.

zhbzhbzhbz avatar zhbzhbzhbz commented on July 23, 2024

感觉数据库加密的功能很有用,不然对于想改数据的人,直接用同包名apk覆盖就行了

from xutils3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.