Results 1 to 18 of 18

Thread: String encryption - suggestions asked

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: String encryption - suggestions asked

    I think a simple permutation of digits satisfies the scheme. If the clients know the scheme of permutations used, they can reverse the process and the server won't have any knowledge about anything if it doesn't know the scheme. I think such thing is used by a security mechanism used by banks (and other) known as the token. I mean the "key change" scheme, the permutation is just a way to scramble input.

  2. #2
    Join Date
    Jun 2006
    Location
    Sweden
    Posts
    99
    Thanks
    11
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: String encryption - suggestions asked

    One way of doing the scrambling is to use a modified version of the RC4 stream cypher. The RC4 uses an array of bytes from 0 to 255. This array is then 'scrambled' with a password. The resulting scrambled array, we'll call it the s-box, is then used to encrypt the data by a similar scrambling process. The resulting cyphertext will be as long as the input-text.

    My proposal is that you instead of using an array from 0 to 255, go from 0 to 9. Then the scrambling and encryption will only occur over those 10 digits. I.e., you're restricting your finite field to 10 instead of 256.

    The reason for modifying RC4 instead of just making something up is that it's a known algorithm that you can find source code for online to alter AND it's *very* quick and simple. Also, it means that each client can have a list of keys instead of different procedures for scrambling data.

    So the clients can share keys and decide on one to use for one communication session. They then encrypt their digits with the session key and send that. Only those that know the session key can decrypt the data.

    With this scheme, you can make sure all the clients share a checksum-key. This key can be used to perform an encryption of the data that only the clients can reproduce - to create your checksum.

    What thinks?

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: String encryption - suggestions asked

    Quote Originally Posted by TheRonin View Post
    The reason for modifying RC4 instead of just making something up is that it's a known algorithm that you can find source code for online to alter AND it's *very* quick and simple. Also, it means that each client can have a list of keys instead of different procedures for scrambling data.
    RC4 has a well-known weakness, so one should at least skip the initial bytes it generates.

    The idea of several scrambling schemes comes from a method for electronic cash verification.

  4. #4
    Join Date
    Jun 2006
    Location
    Sweden
    Posts
    99
    Thanks
    11
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: String encryption - suggestions asked

    RC4 has a well-known weakness, so one should at least skip the initial bytes it generates.
    Indeed, statistical analysis of the first few bytes can reveal a lot about the status of the s-box, indirectly revealing information about the key (the mentioned analysis requires a known plaintext to work). I made the assumption that our friend yop didn't require any extreme encryption scheme for his application. If that were the case, a stream cypher would not be recommended at all. Also, there are methods of patching the mentioned statistical weakness, such as you suggest, discarding the initial output.

    I would think that the security in using different schemes instead of one scheme with keys would be less because of the reduced keyspace. If i were to use one of say, 100 schemes, i only have 100 possible combinations. Compare this to using a key of just 8 bits that gives you 256 possible combinations. You get greater security with less work since you don't need to create a bunch of different scrambling methods.

    Perhaps they combine the two to get added security, but i would think that doing so would produce more potential security problems since some scrambling schemes may be weaker and more prone to attack than others. I believe using a strong method of encryption along with a stable framework for key distribution would be the wise choice, in the field. But i digress...Again, i'm assuming yop is not working on some critical system with enormous security requirements. If he is, i appologize for leading him astray with the less than optimal RC4..just trying to be helpful

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: String encryption - suggestions asked

    Quote Originally Posted by TheRonin View Post
    If i were to use one of say, 100 schemes, i only have 100 possible combinations. Compare this to using a key of just 8 bits that gives you 256 possible combinations. You get greater security with less work since you don't need to create a bunch of different scrambling methods.
    What about 20922789888000 schemes? And all you need is to write a single method that permutes 16-bit value. As long as the server can't tell the difference between a valid string and scrambled one (either by using data it has at hand or by asking one of the clients), you're protected by plain probability.

    Quote Originally Posted by TheRonin View Post
    I believe using a strong method of encryption along with a stable framework for key distribution would be the wise choice, in the field.
    Yes, you're right, but it's hard to meet those same-length and digits-only requirements.
    Last edited by jacek; 15th February 2007 at 16:06. Reason: typo

Similar Threads

  1. saving a c string of variable length in a shared memory?
    By nass in forum General Programming
    Replies: 4
    Last Post: 3rd January 2007, 14:40

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.