2
$\begingroup$

Our application requires some 'mild' form of 'proof of origin' for the tokens we issue (~200 bytes), however, the value of each is trivial. The requirement is to provide 'tamper resistance' rather than 'unforgeable', to not bloat the token size, and to use commonly available 'standard' libraries and tools.

In the token, we include a hash of the request we received, and I understand we can crop this down to the last n (e.g. 48) bits easily enough, and do the same with the token hash/digest before signing.

Is something similar possible with the signature, or do we need to just generate the smallest key and a tiny digest to get the output as small as possible?

I've been mucking about with openssl rsautl - is this as good as any other given our requirements as above? The signatures are coming out at ~24 bytes, I'd like to reduce that a bit further if possible.

EDIT TO ADD

For us, the ability to forge a single signature within a few minutes is perfectly fine, sub-minute is getting problematic. The ability to derive our private key, and subsequently bulk-produce counterfeit signatures with negligible time/energy cost is the primary risk.

With the advice of those below I've been looking at ECDSA and the secp112r1 OpenSSL built-in curve, assuming that is better than a 256bit RSA primary key.

$\endgroup$
  • 1
    $\begingroup$ If you require verification of signature without secret (that is, proper digital signature), 48 bits is way too little. If you can live with a secret key on both sender and verifier side, use a MAC such as HMAC. $\endgroup$ – fgrieu Oct 12 '15 at 17:08
  • 2
    $\begingroup$ I think Ultra Short Weakly Secure Signatures are the closest thing known to what you're asking about. $\;\;\;\;\;\;$ $\endgroup$ – user991 Oct 12 '15 at 17:22
  • 2
    $\begingroup$ @SEJPM Your numbers are too small by a factor of two. A 256 bit curve like P-256 (offering 128 bits of security) produces a 512 bit or 64 byte signature. BLS cuts that in half, to 32 bytes. At 16 bytes you're down to 64 bits of security, which might still be okay for some applications, especially if you throw in a proof-of-work. $\endgroup$ – CodesInChaos Oct 12 '15 at 17:37
  • 2
    $\begingroup$ I don't understand the sentence "The requirement is to provide 'tamper resistance' rather than 'unforgeable'". Tamper residence implies unforgeability, because if a a cipher is forgeable, then there is no need for a more expensive tamper attack. $\endgroup$ – user27950 Oct 12 '15 at 21:21
  • 1
    $\begingroup$ Forgot that 256 bits = 32 bytes. Oops. Thx @CodesInChaos. Concerning your question according to the bear BLS is pretty optimal. You may actually be able to live with 96-bit security level, which would give you 24 byte signatures with BLS. Or if you consider your adversaries to be common people with their common desktops even 64-bit security is enough giving 16 byte signatures with BLS. And yes ECC is much better than RSA at the considered lengths. (I can break 256 bit RSA within seconds IIRC but 128-bit ECC is unbreakable for me) $\endgroup$ – SEJPM Oct 13 '15 at 12:09
1
$\begingroup$

Suppose you have an asymmetric algorithm that creates a 48-bit signature. Then an attacker can simply test possible 48-bit signatures and find one that verifies in $2^{47}$ tries on average. Even with a relatively slow asymmetric algorithm that would be feasible, especially if the attacker can test the same signature for multiple tokens. And that is only a brute force attack, asymmetric systems usually allow much faster attacks.

If you can establish a symmetric secret, even a short MAC is much better, because while the attacker still has a $2^{-48}$ probability of success with a random guess, they can no longer verify those guesses offline.

$\endgroup$
  • $\begingroup$ Thanks Otis. In our application, the forging of an occasional signed document is not a concern - the energy cost probably outweighs the value - Is there somewhere I can look up how long 2^n attempts would take (on, say, a modern gaming PC) -- my googling came up empty. I'm much more concerned about the (short) private key being derived. A symmetric secret is, unfortunately, not viable for us. $\endgroup$ – Justin Maxwell Oct 13 '15 at 11:21
  • $\begingroup$ @user152408, in that case the link Ricky Demer gave in the comments would be your best bet. I haven't seen anything like that implemented in libraries, however. ($2^n$ attempts usually takes $2^{n-30}$ to $2^{n-10}$ seconds on a single computer, depending on the algorithms used.) $\endgroup$ – otus Oct 13 '15 at 12:17
  • $\begingroup$ Note that 48 bits will get really weak if the attacker applies a Time Memory Trade Off. Details depend on the actual algorithm, but a simple, and mostly wrong, back of the napkin calculation could be: 1 Terabyte drive ~ $2^{37}$ stored 48-bit values -> ~$2^11$ lookup operations per attack -> several attacks per second (for SSD) to few seconds per attack (for HDD). $\endgroup$ – Henryk Plötz Oct 13 '15 at 14:06
  • $\begingroup$ @HenrykPlotz : $\:$ Can those specifically target short signatures, rather than just going after the private key? $\endgroup$ – user991 Oct 13 '15 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.