I am currently working on a huge PHP project and we are seriously considering to use the Libsodium PHP library in it.
My question is related to the "sodium crypto box" functionality. We would use this functionality to implement public key authenticated encryption. We would generate keypairs using the "sodium crypto box keypair" function, nonces using the "sodium crypto box noncebytes" function, and seal/open the crypto boxes through the "sodium crypto box" and "sodium crypto box open" functions.
My question is basically "how safe is this"?
Public keys will be public, so our concern is that someone might be able to generate a correctly sealed box by "cracking" somehow the secret key of the sender, or to open a sealed box by cracking the SK of the receiver. These keys are 64-digit hexadecimal strings. Is my assumption correct that this means that there are 16^64?
If yes, this would mean that brute forcing all possible combinations at a rate of 1 million tries per second would take 3.6717430630808 * 10^63 years? Or are there more "efficient" attacks?
On the official Libsodium website I found the following algorithm details with respect to the functions we want to use:
Key exchange: X25519
Encryption: XSalsa20 stream cipher
Authentication: Poly1305 MAC
Can someone try to explain me what this means ? Is following interpretation correct:
- X25519: This is the keypair generation algorithm?
- XSalsa20: This is the encryption algorithm?
- Poly1305: This is the nonce generation algorithm?