Ben H is a user on mastodon.technology. You can follow them or interact with them if you have an account anywhere in the fediverse. If you don't, you can sign up here.
Ben H @equal

Did this crazy experiment last night using my 4096-bit SSH keys (which I usually just use for logging into servers) to sign, verify, encrypt and decrypt files. This is probably obvious to crypto nerds but I didn't know you could do that with SSH keys.

· Web · 0 · 2

@equal This is pedantry, but its still cool you did it.

SSH keys are a type of asymmetric key, and they can only be used to encrypt or sign data that is no larger than the key size. This works if the files are smaller than 4096 bits. Larger files must use a different process. A random symmetric key is generated to encrypt and decrypt the file. Then the symmetric key is encrypted or decrypted using the SSH asymmetric keys.

Something similar works with X.509 certificates too because they are also key pairs.

@zangetsu_MG Yeah, I was wondering why the intermediate key file was used in the examples I was lookjing at. I could see that it _was_ done but nobody was really explaining _why_ (i.e. why must the data be smaller than the key?) If you have a minute and wouldn't mind doing a quick explanation I'd be most grateful.

@zangetsu_MG seems like an easy (and therefore dangerous) thing to misunderstand

@equal Asymmetrically encrypted data must be no larger than the key size for math reasons I don't fully understand. 😅

I have a reasonably good understanding of how to use it, but a not so good understanding about the math behind it.

This is a good place to start reading: en.wikipedia.org/wiki/Hybrid_c

And this is a good place to ask questions: crypto.stackexchange.com/