4
$\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$
14
  • 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
    Commented Oct 12, 2015 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
    Commented Oct 12, 2015 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$ Commented Oct 12, 2015 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
    Commented Oct 12, 2015 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
    Commented Oct 13, 2015 at 12:09

2 Answers 2

2
$\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$
4
  • $\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$ Commented Oct 13, 2015 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
    Commented Oct 13, 2015 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$ Commented Oct 13, 2015 at 14:06
  • $\begingroup$ @HenrykPlotz : $\:$ Can those specifically target short signatures, rather than just going after the private key? $\endgroup$
    – user991
    Commented Oct 13, 2015 at 16:14
2
$\begingroup$

A similar (later) question asks:

what digital signature schemes can be used to generate a small signature of 16-32 bits only?

None. Any Digital Signature that size would be insecure. Elementary argument: the mere fact that the verification procedure is public (the defining property of Digital Signature) allows to forge a $b$-bit signature with at most $2^b$ signature verification operations. And that's far from the best attack in practice.

Based on known signature schemes, it seems we need at least $2b$-bit signature to resist $\mathcal O(2^b)$ effort (I have no articulated argument to prove that must hold for any signature scheme, though). BLS signature, the most compact we have, only approaches that threshold. Even with 128-bit signature, recovering a private key from a public key is feasible with modest means. That then allows to compute a signature of anything as fast as the legitimate holder of the private key does.

Any signature which is strong enough to not be broken within few nanoseconds at hardware level is fine for my application which is time critical.

The fact the question's signatures are short-lived does not help against attacks that recover the private key. What would help to a small degree is that keys would be short-lived, but that's not practical.

For authentication with 32-bit cryptogram or lower, only symmetric cryptography is possible. That requires a secret on the verifying side. That's Message Authentication Code, not Digital Signature, and does not match any of the question's tag.

$\endgroup$
2
  • $\begingroup$ The obvious argument shows that a signature must be at least $b$ bits in length to require $O(2^b)$ to forge - I don't know of a generic argument that claims it must be at least $2b$ bits in length. Could you care to elucidate? $\endgroup$
    – poncho
    Commented Mar 1, 2022 at 13:22
  • $\begingroup$ @poncho: I don't have an articulated argument that we need at least $2b$-bit signature to resist $\mathcal O(2^b)$ effort. It's a mere observation. I clarified that. $\endgroup$
    – fgrieu
    Commented Mar 1, 2022 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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