Login
You're viewing the functional.cafe public feed.

Replies

  • Nov 9, 2026, 8:43 PM
    So apparently, very similar techniques to fix the upper half of the RSA modulus has been considered as a form of compression. It's believed to not compromise security (apart from using all zeros or all ones), although such techniques have largely been abandoned in favor of other cryptosystems that use smaller keys.

    TLDR: I'm disappointed to report that my key might actually be secure.
    💬 0🔄 0⭐ 0
  • 💬 1🔄 0⭐ 0
  • 💬 0🔄 0⭐ 1
  • 💬 1🔄 0⭐ 0
  • 💬 1🔄 0⭐ 2
  • 💬 1🔄 0⭐ 0
  • 💬 0🔄 0⭐ 1
  • 💬 1🔄 0⭐ 1
  • 💬 3🔄 5⭐ 23
  • 💬 1🔄 0⭐ 2
  • 💬 1🔄 0⭐ 1
  • Nov 8, 2026, 9:13 PM

    @hanno @wonka @benbe @nothacking My intuition is that vanity keys limit the key space, because they impose a pattern or constraint. Under the premise, is it worse to limit the public key or the private key?

    💬 1🔄 0⭐ 2
  • 💬 3🔄 0⭐ 2
  • 💬 0🔄 2⭐ 3
  • 💬 0🔄 0⭐ 0
  • Nov 9, 2026, 7:31 AM
    @hanno@mastodon.social @BucciaBuccia@mastodon.social @wonka@chaos.social @benbe@social.chaotikum.org I mean, there's no reason a prime like 313333333337 can't work in RSA. Of course, no one else will know unless they try to factor the modulus. There's no reason to only make one key fancy, although my technique requires the vanity prime in question to be quite large.

    This RSA key has both a vanity prime and a vanity public key.
    -----BEGIN RSA PRIVATE KEY-----
    MIIEoAIBAAKCAQAryWObd6p1/aaZwQneaINL4lslkGOesxFzujQkoPiIzOxVWMHs
    ///Double+Vanity///this/key/has/a/vanity/prime/and/public/key///
    Io/C4HvWPYPgZ/X++2CpbhHG6/lVQgG2eP5340ZadjTl90b4qNJk2MXsZhK5j1c4
    cD1unEZdpCQx/ePawiMYU2yP+dy6w+InhsnqbcDMJtSXhpzWHPXc842j3LY7Y4ZN
    N3LxRkBRXK05v54akC+/+7e8xBQOhCYX6YOG/99VKSpu75TznDMcxSLxR6hg7vkA
    1U/GPb7au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2m+vnC2sxV1IuJ1Y/KmTSKL/HZFABbg5pTgs9bPCKCJy
    DQKBgCJnkdWxL4d48cN4b2GS1jUTX+qp5KYVJkuDgfw2dXGoW9JRw3p8CAbZEMjY
    PviP1i16gtCFBG71KTZ7gQzyZTBOWomSzgKamCbon4hct2/utbBPitLnbV76USUN
    KGzt11D2DGL3ETeHK1Vr1XnDNQ06u9qcgTjgT+Opj+rjxPgY
    -----END RSA PRIVATE KEY-----
    

    To save you a few commands, the value of p is 31333333333700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000257
    💬 0🔄 0⭐ 0
  • Nov 8, 2026, 11:18 PM

    @hanno @wonka @benbe @nothacking The only reason they could have for rejecting it is fear it undermines the trust in LE. As you say though, it's not necessarily insecure, there's no real way to automate the check and if you want an insecure key for your site that's on you.

    💬 0🔄 0⭐ 4
  • Nov 9, 2026, 12:16 AM

    @hanno @wonka @benbe @nothacking
    I actually don't get. I/you generate something and ask Let'sEncrypt to certify that "that" comes/relates to domain. Why should it be checked, only as a matter of cortecy?
    I/you responsible for what we ask to be stamped.

    💬 0🔄 0⭐ 1
  • Nov 8, 2026, 7:59 PM

    @nothacking To be fair, this is in the _public_ key.

    In your case, the string is part of the RSA modulus, which is supposed to be a product of two primes.

    It also seems to be in the topmost bits of the modulus, as your entire modulus appears to be:

    ```
    AMcZO8ePaEDz3mW2///You+dont+actually+have+to+pick+random+private+keys//No+on
    e+checks//A+certificate+aurthority+almost+got+away+with+the+number+4//9XhlXz
    cfLmUaXN621MkimWfwBajCzHPIll9hk5eleHMsu6H//+JOdKml8zQV9pTF8eT2RDXqj/8b4aglZj
    m7GkBfS06iA4s79jazZzmt11YtP9IFi2vHraubrq28diT7Z/+gizriunkGnE8el01suFQbtBB24o
    fAVJqQzAEcIv1fPvI2wRuUm5kWfhs0ERoR10uEk=
    ```

    The way I'd do this is:

    - Choose prime p at random the usual RSA way.
    - Choose prime q at random the usual RSA way, _except_ the RNG is constrained to only generate primes q such that p*q has the desired prefix.
    - The `AMcZO8ePaEDz3mW2` part is probably fixed and chosen once.
    - That way, you simply pick q between `AMcZO8ePaEDz3mW2///You+[...]+number+4/////...` / p and `AMcZO8ePaEDz3mW2///You+[...]+number+5AAAAA...` / p at random, as the only algorithm change.
    - As the fixed prefix is much shorter than half the product, and as p and q are half the length of the product and prime density is 1/ln(n), there should be lots of q available for this to work.

    I conclude your RSA key should actually be OK... kinda.

    💬 0🔄 0⭐ 5
  • Nov 8, 2026, 8:08 PM
    @divVerent@vivaldi.net Not quite, but close:
    (p, q) = gen_rsa_key();
    n = p * q;
    vanity_n = hide_message(n);
    vanity_q = vanity_n / p;
    vanity_q = find_next_prime(vanity_q);
    return (p, vanity_q);
    
    If you already have one of the primes and want a particular public key, it's possible to calculate what the other "prime" by division. However, the resulting number is very unlikely to actually be a prime or even an integer.

    The trick is that since p and q have a similar size, incrementing q will only change the least-significant half of the modulus. Therefore, simply rounding to an integer and finding a nearby prime to the "ideal" q value will preserve a message hidden in the upper half of the modulus.
    💬 2🔄 0⭐ 9
  • Nov 8, 2026, 8:11 PM
    @divVerent@vivaldi.net My code does kinda "bruteforce" until (p-1)(q-1) doesn't share any factors with the public exponent, because that's a requirement for RSA... but it has always finished in one attempt so far.
    💬 1🔄 0⭐ 1
  • Nov 8, 2026, 8:31 PM

    @nothacking Yeah, you need that too, but it's basically irrelevant for security of your cert. Just important for it to work ;)

    💬 0🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0
  • Nov 8, 2026, 10:41 PM
    @assimilateborg@kind.social @divVerent@vivaldi.net From what I've seen, LE will sign anything that doesn't have factors smaller than one thousand... but there's no way to actually use the resulting certificate without having the private exponent which is derived from the two primes.
    💬 1🔄 0⭐ 0
  • Nov 9, 2026, 5:39 AM

    @nothacking @assimilateborg There is, multi-prime RSA is a thing.

    But you then have to compute the private exponent differently. Otherwise your key simply won't _work_. And you can't store the private key in the usual formats that are used for 2-prime RSA, as the CRT parameters will work differently.

    LE or another CA can't detect if you did that or not, and in fact, multi-prime RSA is actually a thing.

    💬 0🔄 0⭐ 0
  • Nov 8, 2026, 8:31 PM

    @nothacking That method is probably somewhat worse than the method I described, but easier to implement.

    First of all, this makes q likely to be a prime after a large block of composites. Kinda biasing q. Not sure if there are known attacks for this property, but definitely a bias. Doesn't seem to be huge though, you maybe lost one bit of entropy there.

    Secondly, you basically ignored every other fun requirement RSA primes should have... but it seems like your primes _likely_ fulfill them, as p and q are unlikely - but possible - to become too close after your manipulation.

    💬 0🔄 0⭐ 1
  • Nov 8, 2026, 10:27 PM

    @divVerent @nothacking Any process for selecting a prime works this way. As numbers get large, primes get sparse, and you'll have large blocks of composites next to most.

    💬 0🔄 0⭐ 0
  • Nov 8, 2026, 8:57 PM

    @nothacking Nothing wrong with vanity pubkeys. RSA makes them easy without any significant loss of security. Doing them with EC is much harder.

    💬 0🔄 0⭐ 2
  • 💬 0🔄 0⭐ 0
  • Nov 8, 2026, 9:52 PM

    @nothacking your site shows the command prompt to get the text.
    Well I made it a little better:
    openssl s_client -connect funnies.maurycyz.com:443 2>/dev/null </dev/null | awk '/\/\//,/\/\/+/' | sed 's,//,\n,g;s/+/ /g'

    💬 0🔄 0⭐ 0
  • 💬 1🔄 0⭐ 0
  • 💬 1🔄 0⭐ 1
  • Nov 8, 2026, 11:34 PM

    @anselmschueler @nothacking That's the intention. I'm guessing OP created the funnies subdomain for funny stuff like this. The command is how to check the certificate they posted above works. A web page could be an empty string or any text, it doesn't have to be whizzbang fonts and sliding images.

    This is a beautiful webpage because it has no more information than needed to convey the concept.

    💬 0🔄 0⭐ 5
  • 💬 0🔄 0⭐ 1
  • Nov 9, 2026, 12:51 AM

    @nothacking to be fair, this isn't really possible to check? any kind of statistical checking on the CA's part would actually *reduce* security, since it reduces the space of keys that need to be searched.

    💬 0🔄 0⭐ 2
  • 💬 0🔄 0⭐ 0
  • 💬 1🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0
  • Nov 9, 2026, 12:05 PM

    @nothacking some exotic factorization-based schemes actually use this for public key compression. You can set up to ⅔ of the upper public key bits to some public random constant and just send the remaining bits

    💬 0🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0
  • Nov 9, 2026, 5:28 PM
    @mercurial@booping.synth.download The format is fixed, but sites are allowed any 2048 bit number, as their RSA modulus (public key), provided that it does not have any factors smaller than 1000.

    However, in order to construct a matching private key (needed to use the certificate), the modulus has to be the product of two large primes, so the trick is to find a pair of 1024 bit primes who's product spells out a message in base64.
    💬 0🔄 0⭐ 0
  • 2something@transfem.social
    Nov 9, 2026, 3:32 PM

    @nothacking@infosec.exchange

    Fun fact: Every once in awhile I make a password a random string of 32 characters, followed by some personal joke that is just for me. I save it in my password manager. Then, if I ever look at the password, I will be reminded of whatever joke I made at the time.

    💬 0🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0
  • 💬 1🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0