Android Question Protect database without sqlcipher

Discussion in 'Android Questions' started by omidaghakhani1368, Jul 2, 2015.

  1. omidaghakhani1368

    omidaghakhani1368 Well-Known Member Licensed User

    Hi.
    If i use sqlcipher in my project therefore add 3mb size to file
    my output project shouldn't above 2 mb
    is there any way to protect database without increase size of file?
     
  2. MaFu

    MaFu Well-Known Member Licensed User

    The standard sqlite database has no encryption.
    You can encrypt yourself the data on insert and decrypt on read. But in this case you cannot use WHERE in SELECT statements because the database engine cannot read the real data.
     
    omidaghakhani1368 likes this.
  3. omidaghakhani1368

    omidaghakhani1368 Well-Known Member Licensed User

    I have think sql cipher is best option
     
  4. incendio

    incendio Well-Known Member Licensed User

    I read SQL cipher don't works on lollipop.
     
  5. omidaghakhani1368

    omidaghakhani1368 Well-Known Member Licensed User

    Oh it is very bad.I force to use random access file.is it good?
     
  6. incendio

    incendio Well-Known Member Licensed User

    Never heard that random access file won't work on lollipop, so I think it's OK to use this method.
     
    omidaghakhani1368 likes this.
  7. Erel

    Erel Administrator Staff Member Licensed User

    I'm not familiar with any such issue.
     
  8. LucaMs

    LucaMs Expert Licensed User

    Why? Can you not write: "SELECT * FROM MyTable WHERE MyField = " & MyEncryptionFunction(MyValue)

    ?
     
    omidaghakhani1368 likes this.
  9. omidaghakhani1368

    omidaghakhani1368 Well-Known Member Licensed User

    I found solution if it is working.
    I read .db file accroding to byte and save it in random access file with password
    and when i want to use bank then read byte from file and write it and use
     
  10. omidaghakhani1368

    omidaghakhani1368 Well-Known Member Licensed User

    It is goo solution
     
  11. MaFu

    MaFu Well-Known Member Licensed User

    You're right, this may work. But it fails on "ORDER BY".
     
  12. LucaMs

    LucaMs Expert Licensed User

    Right
     
  13. omidaghakhani1368

    omidaghakhani1368 Well-Known Member Licensed User

    For order by we can add field to database and extract startwith string and insert into related field
    Example if i insert "Hello" => "asd2#E!@QDsd",also insert H character in field and
    When i want to use order by,we can use Order By sStartWithField DESC

    example table :
    Name ID Phone sStartWidth Name ID Phone sStartWidth
    asd@#asd @#asDD2 @#SDASDqd E => Erel 1 213123 E
    DASd2!#!@ SFSDFSDf23 @#!QDQD!@ O => Omid 2 124123 O

    Maybe?
     
  14. LucaMs

    LucaMs Expert Licensed User

    <----- I don't understand :)
     
  15. omidaghakhani1368

    omidaghakhani1368 Well-Known Member Licensed User

    :)
    Ok
    again explain
    We use order by in sql for sort us record.
    "Order by" always return result with startwith string generally
    we can save startwith string example save "E" from "Erel" in field and when execute query use ORDER BY FieldName DESC
    now what is FieldName above?
    FieldName is field that we add to table for save startwith string example save "E" in field:rolleyes:
     
  16. MaFu

    MaFu Well-Known Member Licensed User

    But if your strings differ after the first character?
     
  17. LucaMs

    LucaMs Expert Licensed User

    ???
     
  18. omidaghakhani1368

    omidaghakhani1368 Well-Known Member Licensed User

    this solution is for first character o_O
     
  19. omidaghakhani1368

    omidaghakhani1368 Well-Known Member Licensed User

    example for "Erel" expression,order by return first "E" then "r" then "e" then "l" and my solution is for first character
     
  20. MaFu

    MaFu Well-Known Member Licensed User

    I know. But in case of names you will have many entries with same first character (and also often same second and third character).
     
Loading...