Re: Is this Possible?

From: clem (clem_at_numeral.com)
Date: 06/25/03


Date: Tue, 24 Jun 2003 21:40:50 -0700

On 24 Jun 2003 01:15:49 -0700, myrddin@iosys.net (Myrddin Emrys)
wrote:
<snip>
>
>I wish to encrypt an IP:PORT datum, 6 bytes. I do not wish the
>encrypted form to be longer than 8 bytes. I need to be able to reform
>the original result after an arbitrary length of time with no
>additional data. The encrypted chunks will have a massive degree of
>duplication, but I wish the encrypted results to be as random as
>possible. I need it to be impossible for an attacker, given the
>hundreds or thousands of encoded chunks, to be able to break the
>cypher.
>
<sip>
>Am I wrong? Is there a way of encoding thousands of (very repetetive)
>6 byte datums so that the cyphers produce different results for the
>same input, but are recoverable without additional data beyond the
>cypher? Would increasing the cypher result from 8 bytes to 14 bytes
>(giving me 64 bits of secure data) make it secure, or does the massive
>repetition (hundreds of thousands of encodings of the same value)
>undermine the security to too great an extent?
<snip>

If you can go to 14 bytes in the field, I think you make analysis of
the IP:PORT difficult.

You'll need a secret key that you use to encrypt and decrypt. This
key will need to be strong and you will need to access it on the
decrypt phase. Of course the value of this key is closely held, as if
it is discovered, you are completely and totally hosed.

Using 3DES

1. Generate a hard-to-guess key of 128-bits. IOW, a strong key.

2. Generate a nonce (non-repeating sequence) of 64-bits (eight bytes)
and do it anyway you want that will guarantee non-repeat, like hashing
a random number and incrementing the random number like a counter with
SHA-256 and taking the MSB 64-bits. You increment, then hash, and
take 64-bits for each encryption.

3. Take the MSB 48-bits of the 64-bit nonce, copy this value for step
5, and prepend the 48-bits to your secret key, hashing this with
SHA-256 and taking the MSB 168-bits to get the session key.

4. Append the remaining 16-bits of the 64-bit nonce to your 48-bit
IP:PORT number to get a 64-bit block and encrypt, giving you an
encrypted 64-bit block.

4. Append the 48-bits from step 3 to your 64-bit encrypted block for
the 112-bit (14 byte value) and you are done.

To get the 48-bit IP:PORT

Get the 112-bit value and slice off the 48-bit value at the end and
use this 48-bit slice to prepend the secret key, hash with SHA-256,
take the MSB 168-bits and use this to decrypt the remaining 64-bit
block and discard the last 16-bytes to give you your cleartext IP:PORT
48-bit value.

This may thwart analysis of the IP:PORT values sufficiently.



Relevant Pages

  • RE: NTE_BAD_DATA
    ... They are NOT used DIRECTLY to encrypt / decrypt data; ... you should generate a RANDOM SESSION KEY and select a SYMMETRIC ENCRYPTION ... // imported from a BLOB read in from the source file or having ...
    (microsoft.public.platformsdk.security)
  • Re: Back Doors
    ... >> Design into the system a master key. ... Encrypt that with public key. ... Decrypt random symmetric key with private key. ...
    (sci.crypt)
  • Re: CAPI and RC4: can not decrypt when Final parameter is set to F
    ... to store ASYMMETRIC key pairs - never symmetric keys like RC4, ... Now when you need to encrypt at one place and decrypt at the other normally ... Get a HCRYPTPROV handle to a key container with CryptAcquireContext ...
    (microsoft.public.platformsdk.security)
  • Re: RSA - Public vs. Private Keys
    ... This is a common pattern for license software ... your client will send a unique machine hash to the ... will let us decrypt with a Public Key (or simply not ... |> RSA is intended to encrypt messages with public keys only. ...
    (microsoft.public.dotnet.security)
  • Re: .NET Crypto Classes Interoperability with Win32 Crypto APIs
    ... when i encrypt a string using .NET classes and try to ... > decrypt it using Win32 APIs, ... > UnicodeEncoding(); ...
    (microsoft.public.dotnet.security)

Quantcast