Skip to content

Key Bytes are Reused #3

Description

Howdy there,

In vernamcipher.c, when the tunnel runs out of key bytes it simply rewinds to the beginning and starts using them again.

Observe lines 218 and 219:

 if (CurrentFP + count > FileSize)
      fseek(fp, 0L, SEEK_SET);

Its important to keep in mind that the security of a OTP relies on the key being generated by a CSPRNG, to obscure patterns in the plaintext, and never reused.

This is because, just like (cipherText ⊕ key) -- ie, ((clearText ⊕ key) ⊕ key) -- cancels out the key and leaves you with plaintext, when you take two different ciphertexts encrypted with the same key and ⊕ them -- (cipherTextA ⊕ cipherTextB), or ((clearTextA ⊕ key) ⊕ (clearTextB ⊕ key)) -- the key cancels out, and you're left with (clearTextA ⊕ clearTextB).

With care, you can often untangle the cleartexts from each other and break the cipher.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions