Questions tagged [libsodium]

"The sodium crypto library". A cryptographic multi-language-library with support for many modern cryptographic primitives, that is a fork of the NaCl library. The library focuses on providing easy-to-use cryptographic primitives.

Filter by
Sorted by
Tagged with
0
votes
2answers
66 views

Would XOR'ing two Argon2 keys add extra security?

When a user registers on the app, they need to provide a password they create and we provide them with a randomly generated passphrase (e.g. Apple Cat Ladder Fire). We then use Libsodium's ...
0
votes
1answer
26 views

Authenticated encryption using libsodium's crypto_box_curve25519xsalsa20poly1305

It seems that crypto_box_easy, generates a random nonce and appends it to the cipher text in libsodium. I understand using the same nonce with the same key can be ...
1
vote
1answer
74 views

Is it OK to just hash a symmetric key to derive an authentication key?

I'm using xsalsa20poly1305 for encryption in my program from libsodium. The recommended size for chunks is 4 kB. In that case, poly1305 will have authentication only for the the individual 4k chunks. ...
0
votes
1answer
58 views

Key clamping in curve25519 not evident in generated key's binary representation

I understand with curve25519 that the private key for secret.box is clamped... I understand that this clamping process to clear ...
0
votes
1answer
45 views

Key exchange and authentication using libhydrogen

I have been able to exchange session keys on two devices using Libhydrogen's Key exchange using the N variant method. I also want to authenticate both devices to have some protection against the Man ...
0
votes
0answers
32 views

Resetting a shared private key

I have a scenario with a user that needs to operate on common data from multiple devices but the link to the server is often offline. Unfortunately in the environment, I trust anything not directly in ...
2
votes
1answer
198 views

Which version of ChaCha is more secure?

Which version of ChaCha is more secure? XChaCha20-Poly1305-IETF ChaCha20-IETF-Poly1305 ChaCha20-Poly1305 I am looking for 256bit strength for large datasets. ...
1
vote
1answer
168 views

Using ECDH for encryption and decryption [duplicate]

I'm playing with cryptography and its use with typescript on one side and PHP on the other side. Now I'm looking for routines that can encrypt and decrypt with ecdh's private and shared keys. Any ...
0
votes
1answer
43 views

specific scenario question relating to using NACL crypto_box in a protocol

Scenario 1: SenderA sends message1 to ReceiverB message1 is encrypted using NACL crypto_box using SenderA secret key and ReceiverB public key. we understand that the NACL crypto_box authenticator ...
1
vote
2answers
85 views

Using public-key signature instead of having API key

I am designing an application that will need an API key. At first I believed that generating a long, random token would be secure enough (say 32 chars string that includes 0-9, a-z and A-Z), and then ...
3
votes
1answer
228 views

Representations of secret keys on Curve25519

https://tools.ietf.org/html/draft-josefsson-tls-curve25519-06#appendix-A.2 gives the following as a secret key / public key combo: ...
0
votes
2answers
60 views

How can I follow the validation and verification recommendations of the NaCl (sodium) secretbox library?

I was advised to use crypto_secretbox_xsalsa20poly1305 due to its simplicity and because it's safe against timing attacks. I'm reading the secretbox tutorial, and ...
2
votes
2answers
143 views

Does libsodium sealed box leak key ids?

I am using python and libnacl, which is a libsodium wrapper, to develop an application where users can deposit encrypted data. Alice uses ...
1
vote
1answer
191 views

libsodium vs gnupg curve25519 compatibility

I am trying to create deterministic GPG keys based on cryptosteel. I have implemented a library for (de)serializing PGP packets and am now trying to use keys generated in libsodium for import in GPG. ...
0
votes
1answer
56 views

Verion of crypto_box() which doesn't allow the sender to decrypt previously sent messages

Libsodium's crypto_box() family of functions allow the sender to send messages using its public/private keypair knowing the receiver's public key, and allow the ...
1
vote
2answers
563 views

Using a LibSodium CryptoBox KeyPair with `crypto_sign`

More of a theoretical question... Taking a system where Lib Sodium has been used for asymmetric encryption, where a "crypto_box_keypair" has been generated, and the public key has been distributed to ...
1
vote
0answers
486 views

On Linux, seeding /dev/urandom does not unblock /dev/random, causing libsodium to hang? [closed]

Edit for clarity: Does the "standard" test for initialization of the Linux non-blocking entropy pool, by attempting to read 1 byte from /dev/random, ignore seeding of /dev/urandom from file at boot, ...
1
vote
1answer
443 views

libsodium stream encryption [closed]

I am new to cryptography, I have used OpenSSL and its aes-256-cfb cipher before to do stream encryption, which works great. Now I am going to try ...
1
vote
1answer
96 views

Verification of HMAC in libsodium

libsodium verifies that the HMAC is correct with the following code: return crypto_verify_32(h, correct) | (-(h == correct)) | sodium_memcmp(correct, h, 32); ...
2
votes
1answer
69 views

Is it possible to derive the recipient's public key from libsodium's crypto_box?

Libsodium has "crypto_box_seal" which according to the documentation is used to "anonymously send messages to a recipient given its public key.", which hides the sender. But Is it possible for Eve to ...
2
votes
2answers
330 views

What is special about an entropy count (RNDGETENTCNT) of 160 for libsodium initialization?

(Moved from StackOverflow) In the Usage documentation for libsodium, before calling the initialization function sodium_init, they suggest you check the entropy ...
3
votes
2answers
626 views

What is the difference between a sealed box and a normal box in libsodium?

I'm trying to learn libsodium to better my crypto knowledge. One nagging question I have is what is the difference between libsodium's sealed box and their normal box? Not in terms of technicalities ...
4
votes
1answer
291 views

I have this list of LibSodium primitives, which should I pick so that the implementations tend to be interoperable?

When I integrate lib sodium, into a c# project, and try to consume, encryption and decryption in a particular way, it works, but the confusion is about, which method to use while encryption or ...
2
votes
0answers
93 views

P2P Website/Database Encryption Process

Sorry if this doesn't fit the guidelines, but I believe it is a conceptual issue that is not opinion-based and can be reasonably answered in a single authoritative answer (I'm also struggling to find ...
2
votes
2answers
363 views

Why are 48 bytes appended to Libsodium encrypted messages if nonce is 24 bits?

When encrypting a string through the Libsodium secret box feature, the ciphertext is 48 bytes longer than the plain text message ... I am wondering why this is ... since the nonce is only 24 bytes.
1
vote
1answer
177 views

Schnorr NIZK over Ed25519

I am trying to implement the following Schnorr non-interactive zero-knowledge protocol: https://tools.ietf.org/html/rfc8235#page-7 I'm using the libsodium 1.0.16 and GNU MP libraries. I just can't ...
3
votes
1answer
639 views

libsodium x25519 and Ed25519 small order check

Studying libsodium implementation of x25519 and Ed25519 I saw that it performs an small order check comparing given inputs with a hard coded blacklist of values. Is this list exhaustive or it is a ...
0
votes
1answer
137 views

Encrypt or decrypt using the private key, and decrypt using the public key?

I am currently trying to figure out if my following scheme is implementable in ECC or whether I can use existing implementation. At first I was going with libsodium but it seems that it really doesn't ...
1
vote
1answer
195 views

Is libsodium's `box` construct secure without additional manual padding of the plaintext before encryption?

I have read the following questions and answers: How safe are Libsodium Crypto Boxes? What can be learned from the ciphertext of LibSodium's crypto_box_detached()? However, neither of these ...
4
votes
1answer
3k views

How to use Libsodium encryption (in PHP) in the most secure possible way?

In a PHP project in which fool-proof encryption is fundamental, I'm using the Libsodium library. Hope you guys can shine some light on the following questions. For all of the following functions, it ...
11
votes
2answers
6k views

How safe are Libsodium Crypto Boxes?

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 ...
-3
votes
2answers
276 views

Libsodium installation issue: Invalid library (maybe not a PHP library) 'sodium.so' in Unknown on line 0 … [closed]

I've been struggling since days to install libsodium on my Debian9/php7.0(with fpm) server ... When I follow the steps outlined on https://paragonie.com/book/pecl-libsodium/read/00-intro.md#installing-...
3
votes
1answer
241 views

Does it matter whether the KDF salt is integrity protected?

I am writing a simple application, mainly as a fun challenge, but also to hopefully someday use as my password manager. I'm using pynacl's SecretBox, which ...
2
votes
1answer
342 views

Is the following crypto compatible so that I can use the same keys for both products (Wireguard & Libsodium)?

I am wondering if it is possible to use the public/private keys of two WireGuard peers also in another communication channel using libsodium? According to the WireGuard Protocol documentation and the ...
1
vote
1answer
665 views

How to find the secret key and nonce from two messages encrypted using the same nonce?

As far as I understand, nonces must not be reused because their reuse allows public key encryption to be broken. If I use NaCl's crypto_box http://nacl.cr.yp.to/...
4
votes
1answer
760 views

Why NaCL does not provide anonymous public key cryptography?

At the same time Sodium provides API for anonymous encryption without using ephemeral keys. Is it a bad practice to just use other user public key to encrypt a message?
0
votes
1answer
305 views

How do I properly calculate an inverse element for curve25519 when implementing Sphinx password store protocol?

There's a new password store mechanism, called Sphinx http://webee.technion.ac.il/~hugo/sphinx.pdf which is very nice and protects from device or user compromise. I haven't found any implementations ...
4
votes
1answer
436 views

Nonce reuse resistance

I read this article and I think the approach outlined there is very interesting for one of our use case. We use ChaCha20 Poly1305 (via Sodium ...
3
votes
1answer
202 views

Does using crypto_stream_xor allow listeners to forge crypto_secretbox messages?

I understand that NaCl's crypto_stream and crypto_stream_xor don't do any authentication, like ...
2
votes
2answers
533 views

Why/how is libsodium/nacl's cryptobox repudiable?

https://nacl.cr.yp.to/box.html see "security model". As far as I can see, Alice encrypts a message using her private key, Bob's public key and a nonce. Bob decrypts the message using Alice's public ...
2
votes
2answers
2k views

Why do two Argon hashes with the same password differ?

Can someone explain to me what the ArgonHashString function in libsodium returns (i'm using the .net port). For example i called it twice with the same string: ...
4
votes
1answer
736 views

What is the best practices for storing ed25519 private keys which is used by nodes of my application to communicate with each other?

I am developing some kind of a p2p network where the nodes communicate with each other via TCP and each message is signed by ed25519 private key. I use libsodium for signing and signature verification....
14
votes
2answers
8k views

Argon2 output length and parameter storage?

I just started using the libsodium port for .net today and the output length parameter kind of confused me (I'm using the argon2i implementation). With my limited exposure to hashing, whatever hash ...
1
vote
1answer
975 views

Can I always derive a key pair from password+salt with libsodium?

I'm using libsodium to create public/secret key pairs from a password and salt combination by using crypto_pwhash_scryptsalsa208sha256 to generate a seed and ...
0
votes
1answer
524 views

Sodium crypto_aead_aes256gcm_encrypt ciphertext length > plaintext length

Using the crypto_aead_aes256gcm functions from Sodium produces a ciphertext of "at most mlen (plaintext length) + crypto_aead_aes256gcm_ABYTES bytes (16 bytes) are put into c (ciphertext), and the ...
1
vote
2answers
213 views

Are there any disadvantages of using libsodiums helpers for en-/decoding/comparision instead of the native ones?

Libsodium has some helpers, which allow hexdecimal decoding, encoding and also constant-time string comparison. So if you use the php binding libsodium-php you ...
1
vote
1answer
374 views

Why does NaCl's crypto_auth have twice the security level of crypto_onetimeauth?

The crypto_auth function produces a 256-bit HMAC, with a 512-bit version also available. But the crypto_onetimeauth function (...
1
vote
1answer
263 views

Is PKCS#7 padding generated with a pseudo-random-number generator okay?

Let's take this PHP code. We use libsodium and libsodium-php. You have $text, $senderPrivateKey, ...
1
vote
0answers
63 views

What is the shortest fingerprint of a Curve25519 public key that is secure [duplicate]

My clients have to exchange public keys. To ensure security they are exchanging fingerprints and typing them into the computer by hands. I want the fingerprints to be as short as possible. I am ...
2
votes
1answer
762 views

How does constant-time comparison work?

libsodium has a method for comparing two byte sequences in constant time. Is the idea here to simply avoid early-out if a difference in the data is detected? When I first heard of such a thing I ...