简体   繁体   中英

How to use pre-shared keys in OpenSSL

Is it possible to generate 2 pre-shared keys on on system, distribute them to two host A and B, so that A and B can then use those keys for the encrypted connection between them? I'm not talking about Public Keys like RSA, but 2 pre-shared keys that get handed over to the two parties!

I'd have to implement that in C++, so if possible I'd need a working solution for that.

Yes, it's possible. What you seem to be looking for is the symmetric-key encryption.

In that case, the key is usually just a required number of random bytes. Any cryptographically secure RNG source is ok for that. If you're going to use openssl afterwards, RAND_bytes() will work.

Also see AES Encryption -Key Generation with OpenSSL

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM