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
0 answers
59 views

Ed25519 and sealed boxes libsodium

Accidentally used ed25519 public key to create libsoidum_sealed_box. Is there any way to decrypt the data if the private key ed25519 is known?
user112852's user avatar
0 votes
1 answer
42 views

How to read libsodium's scalar from integer/bytes or NTL:zz [closed]

Hi I am new to lib sodium, may I ask that is it possible to get scalar of ristretto255 from integer/bytes or NTL:zz? Some thing as follows: ...
js wang's user avatar
  • 327
0 votes
1 answer
44 views

implementing pedersen commtiment using lib sodium

Hi I want to implement pedersen commitment ontop of lib sodium Below is what I am trying to do: comm1: m1G+r1H comm2: m2G+r2H comm3: (m1+m2)G+(r1+r2)H comm4: comm1+comm2 and comm3 should equals ...
js wang's user avatar
  • 327
3 votes
0 answers
96 views

Can I use Libsodium crypto_box_easy for signing with 32 byte keypair?

I have a chat system where multiple clients communicate securely using Libsodium authenticated encryption. Every client have their own 32 byte key pair. If two clients want to communicate they first ...
tobalr's user avatar
  • 131
2 votes
2 answers
308 views

ECDH between identical public keys

We are using libsodium and regarding exchanging secrets we would like to use the so-called crypto_box (https://libsodium.gitbook.io/doc/public-key_cryptography/authenticated_encryption). Under the ...
Trafo's user avatar
  • 21
2 votes
0 answers
135 views

What good elliptic curve uses a scalar field the size of the Ristretto255 group?

I am implementing Bulletproofs over Ristretto255. (I am using libsodium, so can't switch to another Elliptic Curve implementation.) I need to implement zero knowledge verification of elliptic curve ...
Michael's user avatar
  • 21
0 votes
0 answers
73 views

Check if pubkey belongs to twisted Edwards25519

I want to check if some pubkey belongs to twisted edwards25519 (I guess this is used for ed25519 ?) The problem is that I have in theory some valid pubkeys like: ...
bladzio's user avatar
  • 103
1 vote
1 answer
231 views

Simplistic double ratchet implementation

Would something like this be a reasonable way to implement the double ratchet with libsodium? The sodium port that I'm using is quite limited and does not offer a ...
M K's user avatar
  • 113
2 votes
2 answers
325 views

Why is there a slight mismatch most of the time in X25519 private keys depending on functions used, but public keys always match (same seed for both)?

I'm trying to wrap my head around going from a seed to a SigningKey, and also obtaining a ...
mkl's user avatar
  • 107
1 vote
1 answer
378 views

Does the libsodium sealedbox provide forward secrecy?

I am using sodiumoxide, a Rust binding to libsodium that provides a function named sealedbox that requires the receiver's public key. However, they also mention that the message is encrypted with an ...
undefined's user avatar
1 vote
1 answer
186 views

How feasible is it to guess the private key of libsodium by taking into account generation time?

So suppose you are doing this locally (so no network noise), and know the exact specifics of your processor too. Is it feasible to figure out the private key (while having access to the public-key) ...
Hormoz's user avatar
  • 789
1 vote
1 answer
155 views

Disparity between PyNaCl docs and libsodium docs

So if we look here, it shows that libsodium uses three 3 different algorithms for this, which sounds weird to me, cause nothing indicates that anything besides Curve25519 is used in those specific ...
Hormoz's user avatar
  • 789
0 votes
0 answers
304 views

Convert sr25519 key pair to Curve25519 key pair

I'm trying to implement public key encryption that support key pairs generated by different libraries: Curve25519 - libsodium cryptoBoxKeypair() Ed25519 - Google ...
ninja's user avatar
  • 101
1 vote
0 answers
279 views

Implement deterministic authenticated encryption using libsodium

Note: this is my first question on stack exchange, let me know if you miss some details to answer and I will edit the question accordingly Context I'm willing to create a git encryption tool (...
TychoTa's user avatar
  • 11
1 vote
1 answer
680 views

Generate secp256k1 ECC key pair with libsodium

I'm new to crypto and I want to generate a key pair, in C, which would be the equivalent of openssl ecparam -name secp256k1 -genkey -out ec-priv.pem. I love ...
Benoit Duffez's user avatar
2 votes
0 answers
73 views

Is CMS for data still relevant

I have an application where I need to store small to moderate amounts of data in a symmetrically encrypted form. For various reasons, CMS with an AuthEnvelopedData seems to tick all the requirements. ...
mikb's user avatar
  • 121
2 votes
3 answers
982 views

One way shared key encryption with NaCl - is it safe to generate a throwaway keypair for the encrypting party

So, I need users to be able to pass me information that no one else can read, so I've generated a secret key. Using NaCl I create a key pair from that secret key and I share the public key of the key ...
Albert Renshaw's user avatar
1 vote
0 answers
259 views

How do I convert an ed25519 scalar into x25519 for encryption?

In a system I'm working with, we're using Schnorr signatures with scalars generated with libsodium's crypto_core_ed25519_scalar_random. My goal is to use the ...
Andrej Mitrović's user avatar
2 votes
1 answer
188 views

Using crypto_sign then crypto_box_seal for anonymous messages

If you have a message M and you want the sender (alice) to be anonymous to everyone but the recipient (bob), is it ok to do? ...
Gabriel's user avatar
  • 123
3 votes
1 answer
890 views

How to find out the block size of Xchacha20 in Libsodium?

I heard that Xchacha20 works like a block cipher so that even if it wants to encrypt one byte, it will do the work of at least one block. So technically it works similar to a block cipher in counter ...
caveman's user avatar
  • 573
1 vote
1 answer
569 views

Using a nonce as a salt for key derivation

I'm currently playing a bit with PyNaCl (python binding to libsodium) and I want to use the secretbox for symmetric encryption between two parties, which means they both must know the (in my case ...
user69188's user avatar
2 votes
0 answers
153 views

Negotiating a session key, when only one public-key is exchanged via QR Code

Question I want to create a secure channel between a server and a client. It is only important that the client can verify the identity of the server, not the other way around. In my special case, an ...
deiShie0's user avatar
0 votes
0 answers
116 views

Any gotchas when deriving a symmetric key from two seeds?

Consider a connection protocol where, after jumping through several other hoops, Alice and Bob know each others' public keys; and they now want to do a RSA-handshake-kind-of-thing to come up with a ...
Herb Caudill's user avatar
4 votes
1 answer
785 views

Can libsodium's X25519 encryption construction be generalized?

It is my understanding that libsodium's sealed_box is based on X25519, a Diffie-Hellman function: By combining the X25519 key agreement with a symmetric cipher and having a recipient derive the ...
soa's user avatar
  • 43
12 votes
3 answers
3k views

What happened to Poly1305AES? Is it obsolete?

I've been told that Poly1305AES is a great choice of MAC for constrained (embedded) environments. I'd checked out DJB's writing on it briefly, and have to say that I found its simplicity likeable, ...
ulidtko's user avatar
  • 349
5 votes
1 answer
3k views

Should I use NaCl or libsodium for my application?

While looking for end-to-end encryption for my app users, I stumbled upon NaCl and libsodium. I am unsure from a security perspective which of these implementations I should use for my cross-platform ...
user avatar
3 votes
1 answer
2k views

What does "crypto_box" actually mean in libsodium and NaCl?

I cannot find what "crypto_box" actually means. In general, and in specific cases, what does "box" do? I know that libsodium is authenticated encryption, but GPG is not. "Box" makes me think the ...
Napasakorn Sriwonkeed's user avatar
1 vote
1 answer
120 views

Proof possession of private key in libsodium

I would like to proof that I am in possession of private key sk for public key pk using ...
lschmierer's user avatar
1 vote
1 answer
384 views

NACL with public key encryption and authentication

As suggested in this answer i can use nacl for public key encryption with: ...
Florat's user avatar
  • 21
1 vote
0 answers
115 views

is forward secrecy irrelevant for non-streaming applications?

I asked a question yesterday about the Keybase key model and got no answers, unfortunately. Let me rephrase the question to make it clearer: in the case, if 2 users just want to send each other low-...
Ejonas GGgg's user avatar
3 votes
0 answers
122 views

Verifying the ownership of curve25519 public keys

Let's say we have a group of users, authenticated by a server that providers the service, communicating on a secure channel (e.g. over HTTPS/TLS) and each user has a corresponding curve25519 key pair. ...
Kri Noe's user avatar
  • 53
0 votes
2 answers
166 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 ...
Mr_Antivius's user avatar
1 vote
1 answer
583 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 ...
Woodstock's user avatar
  • 1,394
1 vote
1 answer
223 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. ...
The Quantum Physicist's user avatar
1 vote
1 answer
644 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 ...
Woodstock's user avatar
  • 1,394
0 votes
1 answer
443 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 ...
user74221's user avatar
4 votes
1 answer
3k 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. ...
Woodstock's user avatar
  • 1,394
1 vote
1 answer
1k 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 ...
Ritchie's user avatar
  • 11
0 votes
1 answer
60 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 ...
Pavlos's user avatar
  • 3
3 votes
2 answers
2k 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 ...
Ejonas GGgg's user avatar
3 votes
1 answer
477 views

Representations of secret keys on Curve25519

https://datatracker.ietf.org/doc/html/draft-josefsson-tls-curve25519-06#appendix-A.2 gives the following as a secret key / public key combo: ...
neubert's user avatar
  • 2,927
1 vote
2 answers
232 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 ...
The Quantum Physicist's user avatar
2 votes
2 answers
473 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 ...
Brolf's user avatar
  • 23
1 vote
1 answer
578 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. ...
Martijn Otto's user avatar
0 votes
1 answer
143 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 ...
dragonroot's user avatar
1 vote
2 answers
2k 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 ...
Craig Francis's user avatar
1 vote
0 answers
869 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, ...
jksd's user avatar
  • 21
1 vote
1 answer
1k 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 ...
neevek's user avatar
  • 113
2 votes
1 answer
234 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); ...
Alexandre Hamez's user avatar
2 votes
1 answer
144 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 ...
Bear's user avatar
  • 23